Baseline-versus-comparison shifts for each participant, with visit and summary-stat controls.

gsm.safety 1.0.0 · safety.viz 1.4.0 · rendered 2026-07-23

The chart below is live — rendered by the safety.viz shiftPlot module on the package’s example data, with the full control sidebar.

Render this report from a workflow

The same chart ships as a gsm-idiom report workflow. Run it with gsm.core::RunWorkflow() to produce a standalone HTML report, or use the matching runner script:

lWorkflow <- yaml::read_yaml(
  system.file("workflow", "3_reports", "safety_shift_plot.yaml", package = "gsm.safety")
)

gsm.core::RunWorkflow(
  lWorkflow = lWorkflow,
  lData = list(dfResults = ExampleData("adbds"))
)
Rscript inst/examples/shift-plot.R <output-dir>
The full safety_shift_plot.yaml workflow
meta:
  Type: Report
  ID: safety_shift_plot
  Output: html
  Name: Safety Shift Plot Report
  Description: Interactive safety.viz shift plot pairing baseline and comparison visit results.
  lSettings:
    filters:
      - value_col: SITEID
        label: Site ID
      - value_col: SEX
        label: Sex
      - value_col: RACE
        label: Race
      - value_col: ARM
        label: Treatment Group
    baseline_visits:
      - Baseline
    comparison_visits:
      - Week 26
spec:
  dfResults:
    USUBJID:
      type: character
    TEST:
      type: character
    VISIT:
      type: character
    STRESN:
      type: numeric
steps:
  - output: strOutputDir
    name: getwd
  - output: lWidget
    name: gsm.safety::Widget_ShiftPlot
    params:
      dfResults: dfResults
      lSettings: lSettings
  - output: strReportPath
    name: gsm.safety::SaveWidgetReport
    params:
      widget: lWidget
      strOutputDir: strOutputDir
      strOutputFile: ID

The live chart

library(gsm.safety)

dfResults <- ExampleData("adbds")

Widget_ShiftPlot(
  dfResults,
  lSettings = list(
    filters = list(
      list(value_col = "SITEID", label = "Site ID"),
      list(value_col = "SEX", label = "Sex"),
      list(value_col = "RACE", label = "Race"),
      list(value_col = "ARM", label = "Treatment Group")
    ),
    baseline_visits = list("Baseline"),
    comparison_visits = list("Week 26")
  )
)