View source: R/factor.as.numeric.R
factor.as.numeric | R Documentation |
Coerces a factor to a numeric vector based on the labels for the factor levels (rather than the integer codes assigned to them); e.g., factor level "3.5" becomes a value of 3.5. Labels that cannot be coerced to numeric are treated as NA.
factor.as.numeric(x)
x |
factor variable whose labels should be coerced to numeric. |
numeric vector.
my.factor <- as.factor(c(1,2.5,10)) factor.as.numeric(my.factor) # compare to: as.numeric(my.factor)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.