add_val1
is intended for associating value labels with binary, nominal, or
ordinal (e.g., integer) variables, where each of a limited number of distinct
values is to be associated one-to-one with a distinct value label. To assign
labels to ranges of numerical variables, see add_quant_labs
(or
add_quant1
). To apply the same label to multiple distinct values of a
variable, see add_m1_lab
or add1m1
.
add_val1
works with other labelr functions (e.g., add_val_labs
,
drop_val_labs
, get_val_labs
, use_val_labs
, add_lab_cols
) to
facilitate the creation, accessing, modification, use, or deletion of
variable value labels.
Note 1: add_val1
is a variant of add_val_labs
that allows you to specify
only one var to label at a time but that allows you to pass its name without
quoting it (compare add_val1(mtcars, am) to add_val_labs(mtcars, "am").
Note 2: avl1
is a compact alias for add_val1
: they do the same thing,
and the former is easier to type
Note 3: This command is intended exclusively for interactive use. In
particular, the var argument must be the literal name of a single variable
(column) found in the supplied data.frame and may NOT be, e.g., the name of a
character vector that contains the variable (column name) of interest. If you
wish to supply a character vector with the names of variables (columns) of
interest, use add_val_labs()
.