powered by
Build a factor using the order of input character strings
ofactor(x, ...)
A vector of character strings
Other parameters passed to factor
factor
Factor with levels in the same order of the input strings.
# NOT RUN { 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