Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

superFactor

Create a factor with unobserved levels


Description

Create a factor variable and include unobserved levels for compatibility with model prediction functions

Usage

superFactor(x, fullLev)

Arguments

x

a vector to be converted to a factor

fullLev

a vector of factor levels to be assigned to x

Value

a factor variable with all observed levels of x and all levels of x in fullLev

Examples

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

merTools

Tools for Analyzing Mixed Effect Regression Models

v0.5.2
GPL (>= 2)
Authors
Jared E. Knowles [aut, cre], Carl Frederick [aut], Alex Whitworth [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.