Interactive lab-results distributions with normal-range overlays, grouped small multiples, and a linked participant listing.

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

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

gsm.core::RunWorkflow(
  lWorkflow = lWorkflow,
  lData = list(dfResults = ExampleData("adbds"))
)
Rscript inst/examples/histogram.R <output-dir>
The full safety_histogram.yaml workflow
meta:
  Type: Report
  ID: safety_histogram
  Output: html
  Name: Safety Histogram Report
  Description: Interactive safety.viz histogram of long-format labs and vitals 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
      - value_col: USUBJID
        label: Participant ID
    groups:
      - value_col: SITE
        label: Site
      - value_col: SEX
        label: Sex
      - value_col: RACE
        label: Race
      - value_col: ARM
        label: Treatment Group
    display_normal_range: true
    annotate_bin_boundaries: true
    test_normality: true
    group_by: ARM
    compare_distributions: true
spec:
  dfResults:
    USUBJID:
      type: character
    TEST:
      type: character
    STRESN:
      type: numeric
steps:
  - output: strOutputDir
    name: getwd
  - output: lWidget
    name: gsm.safety::Widget_Histogram
    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_Histogram(
  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"),
      list(value_col = "USUBJID", label = "Participant ID")
    ),
    groups = 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")
    ),
    display_normal_range = TRUE,
    annotate_bin_boundaries = TRUE,
    test_normality = TRUE,
    group_by = "ARM",
    compare_distributions = TRUE
  )
)