Learn R Programming

Gmisc (version 3.0.3)

set_column_labels: Add [Hmisc::label()] to multiple columns

Description

Add label attribute using `dplyr` syntax using the [Hmisc::label()]

Usage

set_column_labels(x, ...)

Value

The original data.frame

Arguments

x

The data frame that we want to label

...

Variable names with their intended label, e.g. `mpg = "Miles per gallon"`.

See Also

Other Hmisc helpers: set_column_units()

Examples

Run this code
library(magrittr)
data(mtcars)
mtcars_with_labels <- mtcars %>%
  set_column_labels(mpg = "Gas",
                    cyl = "Cylinders",
                    hp = "Strength")
Hmisc::label(mtcars_with_labels$mpg)

Run the code above in your browser using DataLab