ofactor: Ordered factor

Description Usage Arguments Value Author(s) See Also Examples

View source: R/factor.R

Description

Build a factor using the order of input character strings

Usage

1

Arguments

x

A vector of character strings

...

Other parameters passed to factor

Value

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

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

See Also

factor

Examples

1
2
3
4
5
testStrings <- c("A", "C", "B", "B", "C")
(testFac <- factor(testStrings))
(testOfac <- ofactor(testStrings))

stopifnot(identical(levels(testOfac), c("A", "C", "B")))

ribiosUtils documentation built on March 13, 2020, 2:54 a.m.