library(ussie)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, unionussie helps you work with European football data from the engsoccerdata package by cleaning and manipulating the data into more useful forms.
germany <- uss_make_matches(engsoccerdata::germany, "Germany")
glimpse(germany)
#> Rows: 16,120
#> Columns: 8
#> $ country <chr> "Germany", "Germany", "Germany", "Germany", "Germany", "…
#> $ tier <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ season <int> 1963, 1963, 1963, 1963, 1963, 1963, 1963, 1963, 1963, 19…
#> $ date <date> 1963-08-24, 1963-08-24, 1963-08-24, 1963-08-24, 1963-08…
#> $ home <chr> "Werder Bremen", "1. FC Saarbrucken", "TSV 1860 Munchen"…
#> $ visitor <chr> "Borussia Dortmund", "1. FC Koln", "Eintracht Braunschwe…
#> $ goals_home <int> 3, 0, 1, 1, 2, 1, 1, 1, 3, 4, 3, 4, 2, 2, 3, 1, 1, 0, 2,…
#> $ goals_visitor <int> 2, 2, 1, 1, 0, 1, 4, 1, 3, 2, 0, 0, 3, 0, 1, 0, 3, 4, 3,…Collect match data for a particular country
Use the function uss_get_matches() to get data for a country
germany_matches <- uss_get_matches("germany")
glimpse(germany_matches)
#> Rows: 16,120
#> Columns: 8
#> $ country <chr> "Germany", "Germany", "Germany", "Germany", "Germany", "…
#> $ tier <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ season <int> 1963, 1963, 1963, 1963, 1963, 1963, 1963, 1963, 1963, 19…
#> $ date <date> 1963-08-24, 1963-08-24, 1963-08-24, 1963-08-24, 1963-08…
#> $ home <chr> "Werder Bremen", "1. FC Saarbrucken", "TSV 1860 Munchen"…
#> $ visitor <chr> "Borussia Dortmund", "1. FC Koln", "Eintracht Braunschwe…
#> $ goals_home <int> 3, 0, 1, 1, 2, 1, 1, 1, 3, 4, 3, 4, 2, 2, 3, 1, 1, 0, 2,…
#> $ goals_visitor <int> 2, 2, 1, 1, 0, 1, 4, 1, 3, 2, 0, 0, 3, 0, 1, 0, 3, 4, 3,…We can add filter conditions:
uss_get_matches("italy", season == 1960) |> glimpse()
#> Rows: 306
#> Columns: 8
#> $ country <chr> "Italy", "Italy", "Italy", "Italy", "Italy", "Italy", "I…
#> $ tier <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ season <int> 1960, 1960, 1960, 1960, 1960, 1960, 1960, 1960, 1960, 19…
#> $ date <date> 1960-09-25, 1960-09-25, 1960-09-25, 1960-09-25, 1960-09…
#> $ home <chr> "Udinese Calcio", "Torino FC", "AC Milan", "SPAL 1907 Fe…
#> $ visitor <chr> "Juventus", "Sampdoria", "Calcio Catania", "Calcio Padov…
#> $ goals_home <int> 0, 0, 3, 1, 2, 4, 1, 0, 1, 2, 3, 6, 4, 3, 2, 1, 1, 1, 1,…
#> $ goals_visitor <int> 1, 1, 0, 1, 3, 0, 5, 3, 3, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2,…