library(magrittr)
library(dplyr)
library(csv)
file <- system.file(package = 'yamlet', 'extdata','phenobarb.csv')
x <- as.csv(file)
head(x,3)
# suppose we have an event label stored as a column:
x %<>% mutate(evid = ifelse(
event == 'dose',
'dose of drug administered',
'serum phenobarbital concentration'
)
)
# We can define a conditional label for 'value'
# by mapping evid to event:
x %<>% conditionalize(value, label, event, evid)
x %>% as_yamlet
x %>% write_yamlet
Run the code above in your browser using DataLab