Learn R Programming

ribiosUtils (version 1.5-6)

ofactor: Ordered factor

Description

Build a factor using the order of input character strings

Usage

ofactor(x, ...)

Arguments

x

A vector of character strings

Other parameters passed to factor

Value

Factor with levels in the same order of the input strings.

See Also

factor

Examples

Run this code
# 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