Description Usage Arguments Details Author(s) See Also Examples
labelValues
attach value labels to variables
1 2 3 4 5 6 7 | labelValues(data = NULL, var, lbl, useNA = FALSE)
## Default S3 method:
labelValues(data = NULL, var, lbl, useNA = FALSE)
## S3 method for class 'list'
labelValues(data = NULL, var, lbl, useNA = FALSE)
|
data |
a dataframe object (Optional) |
var |
vectors or lists |
lbl |
specify a string |
useNA |
force to use NA as level, if any |
The order of the labels appearing is the same as output from
tab
function.
If data is specified, it returns the whole dataframe with recoded variables. Otherwise, only one vector can be used to label values.
Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
str(infert)
infert.new <- labelValues(infert, case, c("no", "yes"))
table(infert.new$case)
infert.new <- labelValues(infert,
list(case, induced),
list(c("no", "yes"), c("none", "one", "two")))
table(infert.new$case)
table(infert.new$induced)
summary(labelValues(infert, education, c("low", "mid", "high")))
summary(labelValues(infert,
list(education, induced),
list(c("low", "mid", "high"),
c("none", "one", "two"))))
# vector
case.new <- infert$case
labelValues(NULL, case.new, c("no", "yes"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.