# NOT RUN {
x = 1:3
class(x)
units(x) <- with(ud_units, m/s) # valid
class(x)
y = 2:5
a <- with(ud_units, 1:3 * m/s)
units(a) <- with(ud_units, km/h)
a
# note that these units have NOT been defined or declared before:
set_units(1:5, N/m^2)
set_units(1:5, unitless) # unit "1", unitless
if (require(magrittr)) {
1:5 %>% set_units(N/m^2)
1:10 %>% set_units(m) %>% set_units(km)
}
# }
Run the code above in your browser using DataLab