set_column_units {Gmisc}R Documentation

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

Description

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

Usage

set_column_units(x, ...)

Arguments

x

The data frame that we want to define units on

...

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

Value

The original data.frame

See Also

Other Hmisc helpers: set_column_labels()

Examples

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

[Package Gmisc version 3.0.3 Index]