Given a teams-matches data frame (returned by uss_make_teams_matches()
),
return return a data frame on wins, losses, points, etc.:
cumulative, over the course of each season:
uss_make_seasons_cumulative()
Usage
uss_make_seasons_cumulative(
data_teams_matches,
fn_points_per_win = uss_points_per_win
)
uss_make_seasons_final(
data_teams_matches,
fn_points_per_win = uss_points_per_win
)
Arguments
- data_teams_matches
data frame created using
uss_make_teams_matches()
- fn_points_per_win
function
with vectorized argumentscountry
,season
, that returns a integer indicating points-per-win. A default function is provided,uss_points_per_win()
, which includes the countries inuss_countries()
.
Value
tibble with columns
country
, tier
, season
, team
, date
, matches
, wins
,
draws
, losses
, points
, goals_for
, goals_against
.
Examples
italy <- uss_get_matches("italy") |> uss_make_teams_matches()
uss_make_seasons_cumulative(italy)
#> # A tibble: 50,808 × 12
#> # Groups: country, tier, season, team [1,516]
#> country tier season team date matches wins draws losses points
#> <chr> <int> <int> <chr> <date> <int> <int> <int> <int> <int>
#> 1 Italy 1 1929 AC Milan 1929-10-06 1 1 0 0 2
#> 2 Italy 1 1929 AC Milan 1929-10-13 2 2 0 0 4
#> 3 Italy 1 1929 AC Milan 1929-10-20 3 2 0 1 4
#> 4 Italy 1 1929 AC Milan 1929-10-27 4 3 0 1 6
#> 5 Italy 1 1929 AC Milan 1929-11-03 5 3 1 1 7
#> 6 Italy 1 1929 AC Milan 1929-11-10 6 3 1 2 7
#> 7 Italy 1 1929 AC Milan 1929-11-17 7 3 1 3 7
#> 8 Italy 1 1929 AC Milan 1929-11-24 8 4 1 3 9
#> 9 Italy 1 1929 AC Milan 1929-12-08 9 4 1 4 9
#> 10 Italy 1 1929 AC Milan 1929-12-15 10 5 1 4 11
#> # … with 50,798 more rows, and 2 more variables: goals_for <int>,
#> # goals_against <int>