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

View source: R/set_column_units.R

set_column_unitsR 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)

Gmisc documentation built on Aug. 26, 2023, 1:07 a.m.