head-to-head-functions: Specific functions for computing Head-to-Head matrices

Description Usage Arguments Details Value See Also Examples

Description

Specific functions for computing Head-to-Head matrices.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
h2h_mean_score_diff(matchup_data, ...)

h2h_mean_score_diff_pos(matchup_data, ...)

h2h_mean_score(matchup_data, ...)

h2h_sum_score_diff(matchup_data, ...)

h2h_sum_score_diff_pos(matchup_data, ...)

h2h_sum_score(matchup_data, ...)

h2h_num_wins(matchup_data, half_for_draw = FALSE, ...)

h2h_num(matchup_data, ...)

Arguments

matchup_data

Data of matchups described in head-to-head as input for specific h2h_fun.

...

Additional arguments to be passed to or from methods.

half_for_draw

Whether to count half points for draws in h2h_num_wins.

Details

This is a list of currently implemented h2h_funs:

h2h_mean_score_diff

Computes mean score difference of player2 compared to player1;

h2h_mean_score_diff_pos

Equivalent to h2h_mean_score_diff but returns 0 if result is negative;

h2h_mean_score

Computes mean score of player2;

h2h_sum_score_diff

Computes sum of score differences of player2 compared to player1;

h2h_sum_score_diff_pos

Equivalent to h2h_sum_score_diff but returns 0 if result is negative;

h2h_mean_score_diff_pos

Equivalent to h2h_mean_score_diff but returns 0 if result is negative;

h2h_sum_score

Computes sum of scores of player2;

h2h_num_wins

Computes number of matchups player2 scored more than player1. If half_for_draw is TRUE then it also adds half number of matchups where they had draw. Note that it excludes matchups of the players with themselves;

h2h_num

Computes number of matchups.

Value

All h2h_* are implementations of h2h_fun and return a single Head-to-Head value.

See Also

head-to-head Abstract computing of Head-to-Head matrices.

head-to-head-helpers Head-to-Head helpers.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Initializing data
cr_data <- data.frame(
  game = rep(1:5, each = 2),
  player = rep(1:5, times = 2),
  score = c(31:39, 39)
)
matchup_data <- get_cr_matchups(cr_data)

# Computing Head-to-Head matrices
get_h2h(cr_data, h2h_num_wins)
get_h2h(cr_data, h2h_num_wins, half_for_draw = TRUE)
get_h2h(cr_data, h2h_num_wins, half_for_draw = TRUE, fill = 0)

# Computing Head-to-Head values based on matchups
h2h_mean_score_diff(matchup_data[2, ])
h2h_mean_score_diff(matchup_data[19, ])

echasnovski/comperes documentation built on June 21, 2017, 1:17 a.m.