View source: R/safety_results_over_time.R
| safety_results_over_time | R Documentation | 
Safety Results Over Time plot
safety_results_over_time(data, settings)
data | 
 labs data structured as one record per person per visit per measurement. See details for column requirements.  | 
settings | 
 named list of settings with the parameters specified below.  | 
The settings object provides details the columns in the data set.
"value_col"Value column
"measure_col"Measure column
"measure_values"Measure values
"visit_col"Study Visit
"visitn_col"Study Number
"group_col"Grouping column
"violins"Show Violin plots?
"boxplots"Show Box Plots?
"axis"set to "log" to use a log transformed axis, linear otherwise
"drop_visit_string"Drop visits that contain this string. e.g. "unscheduled"
returns a chart object
library(dplyr)
lb <- safetyData::sdtm_lb
sub_ids <- unique(lb$USUBJID)[1:100]
lb<-lb %>% filter(USUBJID %in% sub_ids)
settings <- list(
    value_col = "LBORRES",
    measure_col = "LBTEST",
    measure_values = c("Chloride"),
    visit_col = "VISIT",
    visitn_col = "VISITNUM",
    axis = "log"
)
safety_results_over_time(lb, settings)
# remove unscheduled visits, add violin plot and 2nd panel
settings$drop_visit_string <- "unscheduled"
settings$violins <- TRUE
settings$measure_values <- c("Albumin")
safety_results_over_time(lb, settings)
# add grouping by treatment
dm_sub <- safetyData::sdtm_dm %>% select(USUBJID, ARM)
dm_lb <- dm_sub %>% left_join(lb)
settings$group_col <- "ARM"
safety_results_over_time(dm_lb, settings)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.