View source: R/changeValLabels.R
changeValLabels | R Documentation |
Change or add value labels of one or multiple variables as part of a GADSdat
object.
changeValLabels(GADSdat, varName, value, valLabel)
GADSdat |
|
varName |
Character vector containing variable names. |
value |
Numeric values which are being labeled. |
valLabel |
Character vector of the new value labels.
Labels are applied in the same ordering as |
Applied to a GADSdat
or all_GADSdat
object, this function is a wrapper
of getChangeMeta
and applyChangeMeta
.
The function supports changing multiple value labels (valLabel
) as well as value labels of
multiple variables (varName
) at once.
Returns the GADSdat
object with changed meta data.
# Change existing value labels
pisa2 <- changeValLabels(pisa, varName = "repeated",
value = c(1, 2),
valLabel = c("no grade repetition", "grade repitition"))
# Add value label to unlabeled value
mtcars_g <- import_DF(mtcars)
mtcars_g2 <- changeValLabels(mtcars_g, varName = "cyl",
value = c(4, 6, 8),
valLabel = c("four", "six", "eight"))
# Add value labels to multiple variables at once
mtcars_g3 <- changeValLabels(mtcars_g, varName = c("mpg", "cyl", "disp"),
value = c(-99, -98),
valLabel = c("missing", "not applicable"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.