Skip to contents

A static ggplot2 figure of the view the group comparison chart opens on: one biomarker's value across the levels of a category, as boxes with the participants as points, one panel per visit, with R's test of each panel printed in its heading. It is the figure Widget_GroupComparison() draws in the browser, from the same settings, and its tests are Analyze_GroupDifference()'s on the same rows.

Usage

Visualize_GroupComparison(dfResults, dfParticipants = NULL, lSettings = list())

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, and offers its category columns to group, colour and panel by; it also says who the participants are. Without it a group comes from a column carried on the results rows. Default: NULL.

lSettings

list bio.viz group comparison settings, as Widget_GroupComparison() takes them, and title, subtitle and footnotes. A figure is of one biomarker, so start_value must name it. Default: list().

Value

A ggplot object.

Titles and footnotes

The settings title, subtitle and footnotes are text with named placeholders, as the chart takes them: a name in braces is replaced by the text of its value, and a name the figure does not have is left as written. This figure fills {measure}, {visits}, {value}, {group}, {n} (the participants drawn), {filters}, {date} and {version}. The last line under the figure is always its own: the date it was drawn, by gsm.bio, and R's method and counts behind each test printed, with the R and gsm.bio versions that computed them.

Examples

if (requireNamespace("ggplot2", quietly = TRUE)) {
  Visualize_GroupComparison(
    Synthetic_Results,
    Synthetic_Participants,
    lSettings = list(
      start_value = "IL-6",
      visits = c("Week 4", "Week 8"),
      value_type = "change",
      baseline_visits = "Baseline",
      group_by = "ARM",
      title = "{measure}: {value} by {group}",
      subtitle = "{n} participants, at {visits}"
    )
  )
}