refactorCategorical: Rename a categorical value

View source: R/MIXTCOMP_formatFunctions.R

refactorCategoricalR Documentation

Rename a categorical value

Description

Rename a categorical value

Usage

refactorCategorical(
  data,
  oldCateg = unique(data),
  newCateg = seq_along(oldCateg)
)

Arguments

data

matrix/data.frame/vector containing the data

oldCateg

vector containing categories to change

newCateg

vector containing new categorical values

Value

Data with new categorical values

Author(s)

Quentin Grimonprez

Examples

dat <- c("single", "married", "married", "divorced", "single")
refactorCategorical(dat, c("single", "married", "divorced"), 1:3)


RMixtCompUtilities documentation built on Sept. 22, 2023, 5:10 p.m.