val2lab: Replace vector/matrix/data.frame/list values with...

Description Usage Arguments Value See Also Examples

View source: R/to_factor.R

Description

val2lab 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 val2lab.

Usage

1

Arguments

x

vector/matrix/data.frame/list

Value

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

See Also

val_lab, var_lab

Examples

1
2
3
4
5
6
7
data(mtcars)
mtcars = within(mtcars,{
                var_lab(mpg) = NULL
                val_lab(am) = c(" automatic" = 0, " manual" =  1)
})

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

adayim/cctab documentation built on Dec. 18, 2021, 10:26 p.m.