Skip to contents

Uses column name if label is missing.

Usage

apply_labels(data, label.vec = var_labels(), overwrite = TRUE)

Arguments

data

data set

label.vec

vector of named character strings, with names being column names.

overwrite

overwrite existing labels. Default is TRUE

Value

data.frame/tibble with labels

Examples

mtcars |>
  apply_labels() |>
  sapply(attributes) |>
  unlist()
#>          mpg.label          cyl.label         disp.label           hp.label 
#> "Miles per gallon"        "Cylinders"             "disp"               "hp" 
#>         drat.label           wt.label         qsec.label           vs.label 
#>             "drat"               "wt"             "qsec"               "vs" 
#>           am.label         gear.label         carb.label 
#>               "am"             "gear"             "carb"