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

values2labels

Replace vector/matrix/data.frame/list values with corresponding value labels.


Description

values2labels replaces vector/matrix/data.frame/list values with corresponding value labels. If there are no labels for some values they are converted to characters in most cases. If there are no labels at all for variable it remains unchanged. v2l is just shortcut to values2labels.

Usage

values2labels(x)

v2l(x)

Arguments

x

vector/matrix/data.frame/list

Value

Object of the same form as x but with value labels instead of values.

See Also

Examples

data(mtcars)
mtcars = modify(mtcars,{
                var_lab(mpg) = NULL
                val_lab(am) = c(" automatic" = 0, " manual" =  1)
})

summary(lm(mpg ~ ., data = values2labels(mtcars[,c("mpg","am")])))

expss

Tables, Labels and Some Useful Functions from Spreadsheets and 'SPSS' Statistics

v0.10.7
GPL (>= 2)
Authors
Gregory Demin [aut, cre], Sebastian Jeworutzki [ctb] (<https://orcid.org/0000-0002-2671-5253>)
Initial release

We don't support your browser anymore

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