These functions help make sure suit values are the
right integer values expected by the configurations used by
piecepackr::game_systems() and ppn::read_ppn().
If the input is numeric it simply uses as.integer() and if the
input is character it tries to cast to a reasonable value.
Examples
piece_suit(c("red", "black", "green", "blue", "yellow", "white"))
#> [1] 1 2 3 4 5 6
piece_suit(c("R", "K", "G", "B", "Y", "W"))
#> [1] 1 2 3 4 5 6
piece_suit(c("suns", "moons", "crowns", "arms"))
#> [1] 1 2 3 4
piece_suit(c("S", "M", "C", "A"))
#> [1] 1 2 3 4
domino_suit(c("\U0001f06e", "\U0001f038"))
#> [1] 4 1
domino_suit(c("zero", "one", "eighteen"))
#> [1] 1 2 19
tarot_suit(c("\u2665", "\u2660", "\u2663", "\u2666"))
#> [1] 1 2 3 4
tarot_suit(c("hearts", "spades", "clubs", "diamonds", "trumps"))
#> [1] 1 2 3 4 5
tarot_suit(c("H", "S", "C", "D"))
#> [1] 1 2 3 4