character_to_number.Rd
Convert string descriptions of competitors into their number
character_to_number(char, pnames)
char2num(char, pnames)
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()
.