h2h_funs: Common Head-to-Head functions

h2h_funsR Documentation

Common Head-to-Head functions

Description

List of commonly used functions for computing Head-to-Head values.

Usage

h2h_funs

Format

An object of class list of length 9.

Details

h2h_funs is a named list of expressions representing commonly used expressions of Head-to-Head functions for computing Head-to-Head values with h2h_long() or h2h_mat(). Names of the elements will be used as Head-to-Head value names. To use them inside h2h_long() or h2h_mat() use unquoting mechanism from rlang package.

Currently present functions:

  • mean_score_diff - computes mean score difference of player1 compared to player2.

  • mean_score_diff_pos - equivalent to mean_score_diff but returns 0 if result is negative.

  • mean_score - computes mean score of player1.

  • sum_score_diff - computes sum of score differences of player1 compared to player2.

  • sum_score_diff_pos - equivalent to sum_score_diff but returns 0 if result is negative.

  • sum_score - computes sum of scores of player1.

  • num_wins - computes number of matchups player1 scored more than player2. Draws (determined by dplyr::near()) are omitted.

  • num_wins2 - computes number of matchups player1 scored more than player2 plus half the number of matchups where they had draw. Note that for equal player1 and player2 there might be non-zero output.

  • num - computes number of matchups.

Note that it is generally better to subset h2h_funs using names rather than indices because the order of elements might change in future versions.

See Also

Long format of Head-to-Head values.

Matrix format of Head-to-Head values.

Examples

ncaa2005 %>% h2h_long(!!!h2h_funs)

ncaa2005 %>% h2h_mat(!!!h2h_funs["num_wins2"])

echasnovski/comperes documentation built on March 5, 2023, 4:27 p.m.