Juanma
29 July 2017
La Liga 2016-2017 stats for Barcelona and Real Madrid players.
Questions to be asnwered.
Which team used more players?
Which team used their main line-up more?
library(readxl)
Real_Madrid_and_Barcelona_Full_Stats <- read_excel("~/R/Real Madrid and Barcelona Full Stats.xlsx")
View(Real_Madrid_and_Barcelona_Full_Stats)
football<-Real_Madrid_and_Barcelona_Full_Stats
View(football)
head(football)## # A tibble: 6 x 13
## Player Team Minutes Appearances Lineups `Substitute in`
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 K. Navas Real Madrid 2430 27 27 0
## 2 Kiko Casilla Real Madrid 990 11 11 0
## 3 Rubén Yáñez Real Madrid 0 0 0 0
## 4 Daniel Carvajal Real Madrid 2014 23 21 2
## 5 Pepe Real Madrid 1081 13 13 0
## 6 Sergio Ramos Real Madrid 2489 28 28 0
## # ... with 7 more variables: `Substitute out` <dbl>, `Substitutes on
## # bench` <dbl>, Goal <dbl>, Assist <dbl>, `Yellow card` <dbl>, `Yellow
## # 2nd/RC` <dbl>, `Red card` <dbl>
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.4.1
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
Barcelona have 5 players in the top right corner.
Next step: see the minutes distribution among the top 11 players
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## # A tibble: 2 x 4
## Team total n media
## <chr> <dbl> <int> <dbl>
## 1 Barcelona 27216 11 2474.182
## 2 Real Madrid 23998 11 2181.636