label_values_dataframe: Apply value labels to dataframe

View source: R/label_values_dataframe.R

label_values_dataframeR Documentation

Apply value labels to dataframe

Description

Apply value labels as defined in formats file to all variables in the dataframe.

Usage

label_values_dataframe(
  df,
  formats_df = formats,
  post_dm = FALSE,
  omit_labelled = FALSE,
  var_selection = c("_all")
)

Arguments

df

dataframe

formats_df

dataframe defining the formats. Must be in standard format containing columns Variable_name, Value_Label_1-x. If needed run function read_formats_xlsx.R beforehand.

post_dm

Logical; if FALSE, all variables are added as part of data management steps defined as "not imported" in column Import_format of the formats file will be omitted.

omit_labelled

Logical; if TRUE, all variables that are already labelled, will be omitted. Default is omit_tagged = FALSE, so that all previously labelled variables will be tagged again. That will re-add factor levels to variables where set_missing_values was already applied.

var_selection

Character vector of selected variables to be labelled. Default var_selection = c("all") means that all variables are selected.

Value

dataframe


marianschmidt/msAutolabelR documentation built on April 17, 2022, 7:42 a.m.