character_to_number | R Documentation |
Convert string descriptions of competitors into their number
character_to_number(char, pnames)
char2num(char, pnames)
char |
Character vector to be converted |
pnames |
Names vector (usually |
In earlier versions of this package, the internal mechanism of functions
such as ggrl()
, and all the C++
code, operated with the
competitors labelled with a non-negative integer; it is then natural to
refer to the competitors as p1
, p2
, etc.
However, sometimes the competitors have names (as in, for example, the
rowing
dataset). If so, it is more natural to refer to the
competitors using their names rather than an arbitrary integer.
Function character_to_number()
converts the names to numbers. If
an element of char
is not present in pnames
, an error is
returned (function char2num()
is an easy-to-type synonym). The
function is here because it is used in ggrl()
.
Robin K. S. Hankin
rank_likelihood
x <- sample(9)
names(x) <- sample(letters[1:9])
H <- rank_likelihood(x)
character_to_number(letters[1:3],pnames(H))
char2num(c("PB","L"),pnames(icons))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.