These functions help make sure rank values are the
right integer values expected by the configurations used by
piecepackr::game_systems() and ppn::read_ppn().
If the input is numeric simply use as.integer() and if the
input is character try to cast to a reasonable value.
Usage
piece_rank(rank)
chess_rank(rank)
dice_rank(rank)
fudge_dice_rank(rank)
percentile_dice_rank(rank)
tarot_rank(rank)Examples
chess_rank(c("P", "N", "B", "R", "Q", "K"))
#> [1] 1 2 3 4 5 6
chess_rank(c("\u265f", "\u265e", "\u265d", "\u265c", "\u265b", "\u265a"))
#> [1] 1 2 3 4 5 6
dice_rank(c("1", "2", "6"))
#> [1] 1 2 6
dice_rank(c("\u2680", "\u2681", "\u2685"))
#> [1] 1 2 6
fudge_dice_rank(c("-", " ", "+"))
#> [1] 1 2 3
percentile_dice_rank(c("00", "10", "90"))
#> [1] 10 1 9
piece_rank(c("n", "a", "2", "3", "4", "5"))
#> [1] 1 2 3 4 5 6
piece_rank(c("\U0001f06e", "\U0001f038"))
#> [1] 1 0
piece_rank(c("zero", "one", "eighteen"))
#> [1] 1 2 19
tarot_rank(c("ace", "ten", "jack", "knight", "queen", "king"))
#> [1] 1 10 11 12 13 14