Description Usage Arguments Examples
View source: R/factor.as.numeric.R
factor.as.numeric intuitively converts a factor vector of numbers to real numbers and not factors. This is typically an issue when there are repeating numbers in a vector or data frame and base R automatically categorizes them as factors.
1 |
x |
1 2 3 4 5 6 7 8 | yourVector <- as.factor(c(1,1,2,2,4,4,4,5,5,5,5))
# this will not work intuitively for numbers
# mistakenly categorized as factors.
as.numeric(yourVector)
# use this instead.
factor.as.numeric(yourVector)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.