Note 1: add_lab_col1
is a variant of add_lab_cols
that allows you to
specify only one variable at a time but that allows you to pass its name
without quoting it (compare add_lab_col1(mtcars, am) to
add_lab_cols(mtcars, "am")).
Note 2: alc1
is a compact alias for add_lab_col1
: 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_lab_cols()
.
add_lab_col1
creates a "labels-on" version of a value-labeled column and
adds that new column to the supplied data.frame. Here, "labels-on" means that
the column's original values are replaced with the corresponding value
labels. Note that this column does not replace but is added to its
parent/source columns in the returned data.frame. The resulting "labels-on"
column is a simple, self-contained character column that cannot itself be
converted or reverted to the original ("labels-off") values of its
parent/source column. See add_lab_cols
for a list of other functions that
may be useful in working with value labels.