powered by
Add label attribute using `dplyr` syntax using the [Hmisc::unit()]
set_column_units(x, ...)
The original data.frame
The data frame that we want to define units on
Variable names with their intended unit, e.g. `hp = "Hp"`.
Other Hmisc helpers: set_column_labels()
set_column_labels()
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