safety_results_over_time: Safety Results Over Time plot

View source: R/safety_results_over_time.R

safety_results_over_timeR Documentation

Safety Results Over Time plot

Description

Safety Results Over Time plot

Usage

safety_results_over_time(data, settings)

Arguments

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.

Details

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"

Value

returns a chart object

Examples

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)


safetyCharts documentation built on March 23, 2022, 1:05 a.m.