# NOT RUN {
library(magrittr)
# Suppose we have a numeric and a character version of treatment:
x <- data.frame(
TRTN = c( 0, 1, 2, 0),
TRTC = c('placebo', 'drug', 'comparitor', 'placebo')
)
x
# Further, we wish to specify a particular display order:
x$TRTC <- factor(x$TRTC, levels = c('drug', 'comparitor', 'placebo'))
# We can use TRTC as the guide for TRTN:
x %<>% modify(TRTN, guide = codelist(x, TRTC, TRTN))
x %>% decorations(TRTN)
# }
Run the code above in your browser using DataLab