View source: R/MIXTCOMP_formatFunctions.R
refactorCategorical | R Documentation |
Rename a categorical value
refactorCategorical(
data,
oldCateg = unique(data),
newCateg = seq_along(oldCateg)
)
data |
matrix/data.frame/vector containing the data |
oldCateg |
vector containing categories to change |
newCateg |
vector containing new categorical values |
Data with new categorical values
Quentin Grimonprez
dat <- c("single", "married", "married", "divorced", "single")
refactorCategorical(dat, c("single", "married", "divorced"), 1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.