h2h_funs {comperes} | R 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 ofplayer1
compared toplayer2
. -
mean_score_diff_pos
- equivalent tomean_score_diff
but returns 0 if result is negative. -
mean_score
- computes mean score ofplayer1
. -
sum_score_diff
- computes sum of score differences ofplayer1
compared toplayer2
. -
sum_score_diff_pos
- equivalent tosum_score_diff
but returns 0 if result is negative. -
sum_score
- computes sum of scores ofplayer1
. -
num_wins
- computes number of matchupsplayer1
scored more thanplayer2
. Draws (determined bydplyr::near()
) are omitted. -
num_wins2
- computes number of matchupsplayer1
scored more thanplayer2
plus half the number of matchups where they had draw. Note that for equalplayer1
andplayer2
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"])