superFactor | R Documentation |
Create a factor variable and include unobserved levels for compatibility with model prediction functions
superFactor(x, fullLev)
x |
a vector to be converted to a factor |
fullLev |
a vector of factor levels to be assigned to x |
a factor variable with all observed levels of x and all levels of x in fullLev
regularFactor <- c("A", "B", "C")
regularFactor <- factor(regularFactor)
levels(regularFactor)
# Now make it super
newLevs <- c("D", "E", "F")
regularFactor <- superFactor(regularFactor, fullLev = newLevs)
levels(regularFactor) # now super
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.