recodeCharcat | R Documentation |
Recodes a character categorical variables to a numerical categorical variable.
recodeCharcat(x, ...)
x |
A character categorical variable |
... |
Other internal arguments |
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.
A numeric categorical variable of the same class as the input.
Adrian Dusa
x <- declared(
c(letters[1:5], -91),
labels = c(Good = "a", Bad = "e", NR = -91),
na_values = -91
)
recodeCharcat(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.