Functions for competition results with games between two players.
1 2 3
Competition results in format ready for
Pairgames is a term for competition results with games between two players.
to_pairgames() is a function that converts competition results into
pairwise games: it drops games with one player and for every game with 3 and
more players this function transforms it into set of separate games between
unordered pairs of players. In other words the result is a set of unordered
matchups (as different games) between different
New game identifiers are integers, order of which respects order of
games stored in
cr_data (based on first occurrence in long format). There
is no particular order in subgames of games with 3 and more players.
Order in which players are assigned to
player2 column in
general shouldn't agree with any order in
Any column except
score will be dropped after
conversion to longcr.
players are allowed. They are treated as different
to_pairgames() is rather compute-intensive and can take much time for
competition results with many games.
to_pairgames() returns a competition results of pairwise games as
widecr object with two players.
is_pairgames() returns a boolean value of whether
cr_data contains only
games between two players.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
cr_data <- data.frame( game = c(rep(1:5, each = 3), 6), player = c(rep(1:5, times = 3), 1), score = 101:116, extraCol = -(1:16) ) to_pairgames(cr_data) # Missing values cr_data_na <- data.frame( game = rep(1L, 3), player = c(1, NA, NA), score = 1:3 ) to_pairgames(cr_data_na) # Checks is_pairgames(cr_data) is_pairgames(to_pairgames(cr_data))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.