The labelled_light (ll) collection is a minimal implementation of core
functions for creating and managing haven_labelled
variables, and with
minimal dependencies. These functions, prefixed with ll_
rely only on base
R, and operate only on objects of type haven_labelled
. All functions check
internally that the variables have the correct class and the correct
structure for labelled variables, satisfying the (minimal) specification
inherent in the parameter documentation of the haven::labelled()
function.
The constructor, ll_labelled()
, creates a labelled variable satisfying that
specification.
ll_labelled(x = double(), labels = NULL, label = NULL)
A valid labelled variable.
A vector to label. Must be either numeric (integer or double) or character.
A named vector or NULL
. The vector should be the same type
as x
. Unlike factors, labels don't need to be exhaustive: only a fraction
of the values might be labelled.
A short, human-readable description of the vector.
Other labelled light:
ll_assert_labelled()
,
ll_to_character()
,
ll_val_labels()
,
ll_var_label()
,
threadbare()