apply_labels: Set variable labels/value labels on variables in the...

Description Usage Arguments Value Examples

Description

apply_labels tries automatically detect what is variable label and what are value labels. .apply_* are versions for working with default dataset. See also var_lab and val_lab.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

data

data.frame/list

...

named arguments. Name of argument is a variable name in data. Arguments values is variable label/value labels. For apply_labels unnamed characters of length 1 are considered as variable labels and named vectors are considered as value labels.

Value

data with applied labels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(mtcars)
mtcars = apply_labels(mtcars,
                      vs = "Engine",
                      vs = num_lab("
                             0 V-engine 
                             1 Straight engine
                             "),
                      am = "Transmission",
                      am = num_lab("
                             0 Automatic 
                             1 Manual
                             ")
)

# 'table' from base R
table(mtcars$vs, mtcars$am)

# more sofisticated crosstable
calculate(mtcars, cro(vs, am))

gdemin/expss documentation built on May 16, 2019, 11:14 p.m.