This function powers computing Head-to-Head values (both long and matrix).

get_matchups(cr_data)

Arguments

cr_data

Competition results ready for as_longcr().

Value

A widecr for games with two players.

Details

get_matchups() returns a tibble of all matchups (pairs of players from one game) actually present in cr_data (including matchups of players with themselves). It has following columns:

  • game - game identifier of matchup.

  • player1 - identifier of first player in matchup.

  • score1 - score of the first player in matchup.

  • player2 - identifier of second player in matchup.

  • score2 - score of the second player in matchup.

Important notes:

  • Matchups are not symmetrical: matchup "player1"-"player2" is considered different from "player2"-"player1" in order to except more advanced, not symmetrical Head-to-Head values.

  • Missing values in player column after conversion to longcr are treated as separate players. It allows operating with games where multiple players' identifiers are not known. However, when computing Head-to-Head values they treated as single player.

See also

Long format of Head-to-Head values.

Matrix format of Head-to-Head values.

Examples

get_matchups(ncaa2005)
#> # A widecr object: #> # A tibble: 40 x 5 #> game player1 score1 player2 score2 #> <int> <chr> <int> <chr> <int> #> 1 1 Duke 7 Duke 7 #> 2 1 Duke 7 Miami 52 #> 3 1 Miami 52 Duke 7 #> 4 1 Miami 52 Miami 52 #> 5 2 Duke 21 Duke 21 #> 6 2 Duke 21 UNC 24 #> 7 2 UNC 24 Duke 21 #> 8 2 UNC 24 UNC 24 #> 9 3 Duke 7 Duke 7 #> 10 3 Duke 7 UVA 38 #> # … with 30 more rows