h2h_funs | R Documentation |
List of commonly used functions for computing Head-to-Head values.
h2h_funs
An object of class list
of length 9.
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.
Long format of Head-to-Head values.
Matrix format of Head-to-Head values.
ncaa2005 %>% h2h_long(!!!h2h_funs) ncaa2005 %>% h2h_mat(!!!h2h_funs["num_wins2"])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.