powered by
Build a factor using the order of input character strings
ofactor(x, ...)
Factor with levels in the same order of the input strings.
A vector of character strings
Other parameters passed to factor
factor
Jitao David Zhang <jitao_david.zhang@roche.com>
testStrings <- c("A", "C", "B", "B", "C") (testFac <- factor(testStrings)) (testOfac <- ofactor(testStrings)) stopifnot(identical(levels(testOfac), c("A", "C", "B")))
Run the code above in your browser using DataLab