library(units)
library(magrittr)
x <- 1:10
attr(x, 'label') <- 'acceleration'
units(x) <- 'm/s^2'
y <- as_units('kg')
x %>% attr('label')
x %>% append_units %>% attr('label')
y %>% attr('label')
y %>% append_units %>% attr('label')
x %>% append_units(style = 'plain')
x %>% append_units(style = 'plotmath')
x %>% append_units(style = 'latex')
Run the code above in your browser using DataLab