Skip to contents

Assign data labels to specified variables [Experimental]

Usage

set_labels(tbl, dict, vars = NULL, ignore_case = FALSE)

Arguments

tbl

data.frame: Data.frame with the data

dict

data.frame: Dictionary with all the data labels to use

vars

character: If specified, only labels are assigned to those variables

ignore_case

logical: Indicate if case sensitive should be ignored.

Value

The data entered in the tbl argument but with data labels

Examples

if (FALSE) {
dict <- list(
  SEX = list(
    lab = "Sex of the person",
    labs = c(
      "Man" = 1,
      "Woman" = 2
    )
  )
)
df <- data.frame(SEX = c(1, 2))
str(df)
str(set_labels(df, dict = dict))
}