copy_labels: Copy 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 copies these value and variable
labels back to subsetted data frames that have been subsetted, for instance,
with subset.
Usage
copy_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 = NULL) or with copied value and variable label
attributes (if df_origin was the original subsetted data frame).