Per-participant change on two measures at once — ALT versus AST by default — with an optional regression line.

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

The chart below is live — rendered by the safety.viz deltaDelta 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_delta_delta.yaml", package = "gsm.safety")
)

gsm.core::RunWorkflow(
  lWorkflow = lWorkflow,
  lData = list(dfResults = ExampleData("adbds"))
)
Rscript inst/examples/delta-delta.R <output-dir>
The full safety_delta_delta.yaml workflow
meta:
  Type: Report
  ID: safety_delta_delta
  Output: html
  Name: Safety Delta-Delta Report
  Description: Interactive safety.viz delta-delta plot of change-from-baseline in two labs measures.
  lSettings:
    filters:
      - value_col: SITE
        label: Site
      - value_col: SEX
        label: Sex
      - value_col: RACE
        label: Race
      - value_col: ARM
        label: Treatment Group
      - value_col: USUBJID
        label: Participant ID
    measure_x: Alanine Aminotransferase
    measure_y: Aspartate Aminotransferase
    add_regression_line: true
spec:
  dfResults:
    USUBJID:
      type: character
    TEST:
      type: character
    STRESN:
      type: numeric
    VISIT:
      type: character
steps:
  - output: strOutputDir
    name: getwd
  - output: lWidget
    name: gsm.safety::Widget_DeltaDelta
    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_DeltaDelta(
  dfResults,
  lSettings = list(
    filters = list(
      list(value_col = "SITE", label = "Site"),
      list(value_col = "SEX", label = "Sex"),
      list(value_col = "RACE", label = "Race"),
      list(value_col = "ARM", label = "Treatment Group"),
      list(value_col = "USUBJID", label = "Participant ID")
    ),
    measure_x = "Alanine Aminotransferase",
    measure_y = "Aspartate Aminotransferase",
    add_regression_line = TRUE
  )
)