add_labels: Set back value and variable labels to subsetted data frames
Description
Subsetting-functions usually drop value and variable labels from
subsetted data frames (if the original data frame has value and variable
label attributes). This function adds back these value and variable
labels to subsetted data frames that have been subsetted with subset,
select or filter.
In case df_origin is NULL, all possible label attributes
from df_new are removed.
Usage
add_labels(df_new, df_origin = NULL)
Arguments
df_new
the new, subsetted data frame.
df_origin
the original data frame where the subset (df_new) stems from;
use NULL, if value and variable labels from df_new should be removed.
Value
Returns df_new with either removed value and variable label attributes
(if df_origin was NULL) or with added value and variable label
attributes (if df_origin was the original subsetted data frame).
See Also
http://www.strengejacke.de/sjPlot/labelleddata/{sjPlot-manual}
on working with labelled data, and remove_labels for
removing label attributes from data frames.