f.as.numeric | R Documentation |
Convert factor with numeric labels into numeric vector
f.as.numeric(x)
x |
a factor with numeric labels |
Ulrike Grömping, groemping@beuth-hochschule.de
Ben Wiseman, benjamin.wiseman@kornferry.com
x <- factor(c(11, 22, 33, 99))
as.numeric(x)
# 1 2 3 4 # NOT typically the desired.expected output
f.as.numeric(x)
# 11 22 33 99 # Typically desired output
# Or...
as.numeric(as.character(x)) # A tad unsightly
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.