Skip to contents

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 arguments country, season, that returns a integer indicating points-per-win. A default function is provided, uss_points_per_win(), which includes the countries in uss_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,515]
#>    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-06       2     2     0      0      4
#>  3 Italy       1   1929 AC Milan 1929-10-13       3     3     0      0      6
#>  4 Italy       1   1929 AC Milan 1929-10-13       4     4     0      0      8
#>  5 Italy       1   1929 AC Milan 1929-10-27       5     5     0      0     10
#>  6 Italy       1   1929 AC Milan 1929-10-27       6     6     0      0     12
#>  7 Italy       1   1929 AC Milan 1929-11-10       7     6     0      1     12
#>  8 Italy       1   1929 AC Milan 1929-11-10       8     6     0      2     12
#>  9 Italy       1   1929 AC Milan 1929-11-24       9     7     0      2     14
#> 10 Italy       1   1929 AC Milan 1929-11-24      10     8     0      2     16
#> # … with 50,798 more rows, and 2 more variables: goals_for <int>,
#> #   goals_against <int>