Labels {declared} | R Documentation |
Functions to extract information about the declared variable / value labels, or to declare such values if they are present in the data.
value_labels(x, prefixed = FALSE) value_labels(x) <- value variable_label(x) variable_label(x) <- value
x |
A declared vector. |
prefixed |
Logical, prefix labels with values. |
value |
Any vector of values that should be declared as missing
(for |
value_labels()
will return a named vector.
variable_label()
will return a single character string.
x <- declared(c(-2, 1:5, -1), labels = c(Good = 1, Bad = 5, DK = -1), na_values = c(-1, -2), label = "Test variable") x value_labels(x) value_labels(x) <- c(Good = 1, Bad = 5, DK = -1, NotApplicable = -2) variable_label(x) variable_label(x) <- "This is a proper label" x