lab2val: Replace vector/matrix/data.frame values with corresponding...

View source: R/labels.R

lab2valR Documentation

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

Description

lab2val replaces vector/matrix/data.frame 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.

Usage

lab2val(x)

Arguments

x

vector/matrix/data.frame

Value

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

References

This is a modified version from 'expss' package.

See Also

val_lab, var_lab

Examples

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

table(lab2val(mtcars$am))

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

shug0131/cctu documentation built on Nov. 10, 2023, 12:03 p.m.