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 sophisticated crosstable
cross_cases(mtcars, vs, am)
# the same but with list argument
list_arg = list( vs = "Engine",
vs = num_lab("
0 V-engine
1 Straight engine
"),
am = "Transmission",
am = num_lab("
0 Automatic
1 Manual
")
)
mtcars = apply_labels(mtcars, list_arg)
Run the code above in your browser using DataLab