as_dvec.units {yamlet} | R Documentation |
Coerce Units to Decorated Vector
Description
Coerces units to dvec.
Usage
## S3 method for class 'units'
as_dvec(x, ...)
Arguments
x |
units |
... |
passed arguments |
Examples
library(magrittr)
library(dplyr)
a <- data.frame(id = 1:4, wt = c(70, 80, 70, 80), sex = c(0,1,0,1))
a %<>% decorate('wt: [ body weight, kg ]')
a %<>% decorate('sex: [ sex, [ female: 0, male: 1]]')
a %<>% decorate('id: identifier')
a %<>% resolve
a %<>% mutate(wt = as_units(wt))
a %<>% mutate(wt = as_dvec(wt))
str(a$wt)
[Package yamlet version 1.0.3 Index]