Description Usage Arguments Value Author(s) See Also Examples
reorder the factor levels in a factor
1 | reorderFactor(x, newLevels)
|
x |
factor to reorder |
newLevels |
character vector: levels in new order |
factor with levels corresponding to newLevels
Thomas Wutzler
seqRange
, twMisc
1 2 3 4 5 6 7 | x <- as.factor(sample(c("low","medium","high"),10,replace=TRUE) )
x
as.integer(x)
y <- reorderFactor(x,c("low","medium","high"))
y
as.integer(y)
all(x == y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.