View source: R/class_trial_comparison.R
| plot.TrialComparison | R Documentation |
Plots selected variables from a trial comparison.
The summary method plots the objects contained in the comparison.
## S3 method for class 'TrialComparison'
plot(
x,
xAxis = NULL,
yAxis = NULL,
...,
data = NULL,
category = NULL,
group = NULL,
main = NULL,
xlab = NA_character_,
ylab = NA_character_
)
## S3 method for class 'TrialComparisonSummary'
plot(
x,
xAxis = NULL,
yAxis = NULL,
...,
showSummary = FALSE,
category = NULL,
group = NULL,
data = NULL
)
x |
A |
xAxis, yAxis |
Optional axis column names or captions. Omitted axes are
selected only when there is exactly one candidate: inputs/design settings
are preferred for x, results for y, then other varying numeric columns.
Identifier columns are excluded; stages remain eligible axes. |
... |
Arguments passed to |
data |
Optional comparison data frame with additional annotation columns.
Rows must follow the order of |
category |
Optional column names defining categories. Multiple columns define joint categories. NULL selects automatically; NA_character_ or character(0) disables categories. |
group |
Optional column name defining an additional grouping. |
main |
Plot title. When omitted, generated from the original objects. NULL or NA hides the title. |
xlab, ylab |
Axis labels. NA uses automatic parameter captions; NULL hides
the label. |
showSummary |
If TRUE, also print the summary before creating its plot. |
xAxis, yAxis, category, and group accept technical column names,
captions from the parameter dictionary, and object-specific captions as in
fetch(). For example, "Alternative" and "Alternatives" both select
alternative. Names may also be unquoted, including inside c(...).
Defined variables and other expressions are evaluated in the calling environment.
Exact column names take precedence over captions. Other names must resolve
unambiguously to a column present in the comparison export; harmonized names
are taken into account. With fixed plans alone, "Number of subjects" can
select nFixed. Unknown names, ambiguous captions and duplicate selections
(including two aliases for one column) raise selection errors.
A ggplot object. Ambiguous selections raise an error listing candidate descriptions and a concrete example.
comparison <- getSampleSizeMeans(alternative = 0.22, stDev = 0.5) |>
compare(getSampleSizeMeans(alternative = 0.44, stDev = 1)) |>
compare(getSampleSizeMeans(alternative = 0.59, stDev = 1))
plot(comparison,
xAxis = "Alternative",
yAxis = c("Number of subjects", "Critical values (treatment effect scale)"),
category = "Standard deviation"
)
plot(comparison, xAxis = alternative, yAxis = numberOfSubjects, group = stDev)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.