
Last chance! 50% off unlimited learning
Sale ends in
x
, resp. to a set of variables in a
data.frame
or list
-object. Unlike set_labels
,
add_labels
does not replace existing value labels, but adds
value
to the existing value labels of x
.add_labels(x, value)add_labels(x) <- value
list
of variables or a data.frame
where value label attributes should be added. Does not replaces former
value labels.x
as
"labels"
or "value.labels"
attribute. If x
is
a data frame, value
may also be a list
x
with additional value labels.set_label
to manually set variable labels or
get_label
to get variable labels; set_labels
to
add value labels, replacing the existing ones.data(efc)
get_labels(efc$e42dep)
x <- add_labels(efc$e42dep, c(`nothing` = 5))
get_labels(x)
x <- add_labels(efc$e42dep, c(`nothing` = 5, `zero value` = 0))
get_labels(x, include.values = "p")
# replace old values
x <- add_labels(efc$e42dep, c(`not so dependent` = 4, `lorem ipsum` = 5))
get_labels(x, include.values = "p")
# replace values, alternative function call
add_labels(x) <- c(`new second` = 2)
Run the code above in your browser using DataLab