recodeCharcat: Recode character categorical variables

recodeCharcatR Documentation

Recode character categorical variables

Description

Recodes a character categorical variables to a numerical categorical variable.

Usage

recodeCharcat(x, ...)

Arguments

x

A character categorical variable

...

Other internal arguments

Details

For this function, a categorical variable is something else than a base factor. It should be an object of class "declared", or an object of class "haven_labelled_spss", with a specific attribute called "labels" that stores the value labels.

Value

A numeric categorical variable of the same class as the input.

Author(s)

Adrian Dusa

Examples

x <- declared(
    c(letters[1:5], -91),
    labels = c(Good = "a", Bad = "e", NR = -91),
    na_values = -91
)

recodeCharcat(x)


DDIwR documentation built on Oct. 1, 2023, 5:06 p.m.

Related to recodeCharcat in DDIwR...