library(dplyr)
library(magrittr)
library(csv)
library(haven)
file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
x <- decorate(as.csv(file))
x %>% select(Subject) %>% decorations
x %<>% redecorate('Subject: Patient Identifier')
x %>% select(Subject) %>% decorations
# xpt may already have labels:
dm <- 'extdata/dm.xpt.gz' %>%
system.file(package = 'yamlet') %>%
gzfile %>%
read_xpt
dm %>% class
dm %>% decorations(AGE, SEX, RACE)
# but technically not decorated, and poor persistence:
bind_rows(dm, dm) %>% decorations(AGE, SEX, RACE)
# self-redecorating helps:
dm %<>% redecorate
bind_rows(dm, dm) %>% decorations(AGE, SEX, RACE)
Run the code above in your browser using DataLab