fact2num | R Documentation |
Converts “numeric” factor levels to numeric values.
fact2num(object)
object |
A vector with “numeric” factor levels to be converted to numeric values. |
A numeric vector.
Derek H. Ogle, DerekOgle51@gmail.com
junk <- factor(c(1,7,2,4,3,10))
str(junk)
junk2 <- fact2num(junk)
str(junk2)
## ONLY RUN IN INTERACTIVE MODE
if (interactive()) {
bad <- factor(c("A","B","C"))
# This will result in an error -- levels are not 'numeric'
bad2 <- fact2num(bad)
} ## END IF INTERACTIVE MODE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.