Learn R Programming

Gmisc (version 3.0.3)

set_column_units: Add [Hmisc::unit()] to multiple columns

Description

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

Usage

set_column_units(x, ...)

Value

The original data.frame

Arguments

x

The data frame that we want to define units on

...

Variable names with their intended unit, e.g. `hp = "Hp"`.

See Also

Other Hmisc helpers: set_column_labels()

Examples

Run this code
library(magrittr)
data(mtcars)
mtcars_with_units <- mtcars %>%
  set_column_units(wt = "1000 lbs")
Hmisc::units(mtcars_with_units$wt)

Run the code above in your browser using DataLab