Description Usage Arguments Value Examples
The way R maps levels to values is often not clear so it can help to print out the explicit mapping.
1 |
x |
factor variable |
data.frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | x = c(2,3,1,1,1,3,3,2,2,1)
v1 = factor(x, levels = c(1, 2, 3), labels = c("red", "blue", "green"))
v1
FactorMapping(v1)
v11 = factor(x, levels = c(3, 2, 1), labels = c("red", "blue", "green"))
v11
FactorMapping(v11)
v111 = factor(x, labels = c("red", "blue", "green"))
FactorMapping(v111)
v111
v1111 = factor(c(4,3,1,1,1,3,3,4,4,1), labels = c("red", "blue", "green"))
FactorMapping(v1111)
v1111
####################
x2 = c(3,3,3,1,1,1,1,5,5,3,1)
v2 = ordered(x2, levels = c(1, 3, 5), labels = c("Low", "Medium", "High"))
v2
####################
test = factor(c("yes","no"))
levels(test)
test
FactorMapping(test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.