The function has to working modes. If replace_meta_data
is TRUE
, by
default, if cause_label_df
contains a column
named resp_vars
, then the missing/jump codes in
meta_data[, c(MISSING_CODES, JUMP_CODES)]
will be overwritten, otherwise,
it will be labeled using the cause_label_df
.
prep_add_cause_label_df(
meta_data = "item_level",
cause_label_df,
label_col = VAR_NAMES,
assume_consistent_codes = TRUE,
replace_meta_data = ("resp_vars" %in% colnames(cause_label_df))
)
data.frame updated metadata including all the code labels in missing/jump lists
data.frame the data frame that contains metadata attributes of study data.
data.frame missing code table. If missing codes have labels the respective data frame can be specified here, see cause_label_df
variable attribute the name of the column in the metadata with labels of variables
logical if TRUE and no labels are given and the same missing/jump code is used for more than one variable, the labels assigned for this code will be the same for all variables.
logical if TRUE
, ignore existing missing codes
and jump codes and replace them with
data from the cause_label_df
. Otherwise,
copy the labels from cause_label_df
to
the existing code columns.
If a column resp_vars
exists, then rows with a value in resp_vars
will
only be used for the corresponding variable.
prep_extract_cause_label_df