#########################################################
##### Example: Simple Data Listing #####
#########################################################
library(sassy)
library(magrittr)
options("logr.notes" = FALSE)
# Get path to temp directory
tmp <- tempdir()
# Get path to sample data
pkg <- system.file("extdata", package = "sassy")
# Open log
lgpth <- log_open(file.path(tmp, "example1.log"))
sep("Get Data")
# Define data library
libname(sdtm, pkg, "csv") %>% put()
sep("Write Report")
# Define table object
tbl <- create_table(sdtm$DM) %>%
define(USUBJID, id_var = TRUE)
# Construct report path
pth <- file.path(tmp, "output/l_dm.rtf") %>% put()
# Define report object
rpt <- create_report(pth, output_type = "RTF", font = "Courier") %>%
page_header("Sponsor: Company", "Study: ABC") %>%
titles("Listing 1.0", "SDTM Demographics") %>%
add_content(tbl, align = "left") %>%
page_footer(Sys.time(), "CONFIDENTIAL", "Page [pg] of [tpg]")
# Write report to file system
write_report(rpt) %>% put()
# Close log
log_close()
# View report
# file.show(pth)
# View log
# file.show(lgpth)
Run the code above in your browser using DataLab