Skip to contents

A static ggplot2 figure of the curves the stratified survival chart opens on: each group's Kaplan-Meier curve on one endpoint, with its confidence band, a mark at each censored time, and R's log-rank test, medians and hazard ratio printed under the figure. The groups, who is drawn and the test are those of Widget_StratifiedSurvival() at the same settings, and the test is Analyze_Survival()'s on the same rows. The curves and their bands are R's own: survival::survfit() on those rows, with the log-log interval Analyze_Survival() reports its medians by.

Usage

Visualize_StratifiedSurvival(
  dfResults,
  dfParticipants = NULL,
  lSettings = list(),
  dfOutcomes = NULL
)

Arguments

dfResults

data.frame Long-format results, one row per participant, biomarker and visit. Column names are supplied by lSettings; the defaults expect USUBJID/TEST/STRESN/VISIT/VISITNUM/STRESU, the columns of Synthetic_Results.

dfParticipants

data.frame One row per participant, or NULL. With it the chart has filters, offers its category columns to the Groups control, and its numbers can be cut. Default: NULL.

lSettings

list bio.viz stratified survival settings, as Widget_StratifiedSurvival() takes them, and title, subtitle and footnotes. Default: list().

dfOutcomes

data.frame The outcomes table, as Widget_StratifiedSurvival() takes it. A figure needs one.

Value

A ggplot object.

Titles and footnotes

The settings title, subtitle and footnotes are text with named placeholders, as for Visualize_GroupComparison(). This figure fills {endpoint} (by its label), {group} (what the groups are), {n} (the participants drawn), {filters}, {date} and {version}.

Examples

if (requireNamespace("ggplot2", quietly = TRUE)) {
  Visualize_StratifiedSurvival(
    Synthetic_Results,
    Synthetic_Participants,
    lSettings = list(
      endpoint = "EFS",
      group_by = list(measure = "CRP", visit = "Baseline", cut = "median"),
      title = "{endpoint} by {group}"
    ),
    dfOutcomes = Synthetic_Outcomes
  )
}