pairgames: Competition results with games between two players

Description Usage Arguments Details Value Examples

Description

Functions for competition results with games between two players.

Usage

1
2
3
to_pairgames(cr_data)

is_pairgames(cr_data)

Arguments

cr_data

Competition results in format ready for as_longcr().

Details

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 players.

Important notes:

Value

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.

Examples

 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))

echasnovski/comperes documentation built on Oct. 22, 2018, 9:25 p.m.