Learn R Programming

simFastBOIN (version 1.3.2)

print.boin_multi_summary: Print Method for BOIN Multi-Scenario Summary

Description

Custom print method for "boin_multi_summary" objects returned by sim_boin_multi(). Displays aggregated operating characteristics in formatted tables with options for plain text or kable output.

Usage

# S3 method for boin_multi_summary
print(x, scenario_name = NULL, percent = FALSE, kable = FALSE, kable_format = "pipe", ...)

Value

Invisibly returns the input object x. Function is called for printing side effect.

Arguments

x

Object of class "boin_multi_summary" returned by sim_boin_multi().

scenario_name

Character. Optional name for display header (for compatibility with print.boin_summary). Ignored for multi-scenario results. Default is NULL.

percent

Logical. If TRUE, display "Avg Pts" and "Avg DLTs" as percentages of totals. If FALSE (default), display as absolute numbers. Default is FALSE.

kable

Logical. If TRUE, format output as knitr::kable table. If FALSE (default), display as plain text table. Default is FALSE.

kable_format

Character. Format for kable output when kable = TRUE. Options include "pipe" (Markdown pipes, default), "simple" (minimal formatting), "latex" (LaTeX format), and "html" (HTML format). Default is "pipe".

...

Additional arguments (currently unused, for S3 method consistency).

Details

Displays a summary table with:

  • Rows organized by scenario and metric (True Tox (%), MTD Sel (%), Avg Pts, Avg DLTs)

  • Columns for each dose level plus Total/No MTD statistics

  • Scenario names grouped for easy visual comparison

  • All text left-aligned for consistency

When percent = FALSE (default), "Avg Pts" and "Avg DLTs" are displayed as absolute numbers.

When percent = TRUE, these rows display percentages of their respective totals for each trial. This facilitates visual comparison of dose allocation patterns across scenarios independent of total sample size.

When kable = FALSE (default), displays as plain text table in console.

When kable = TRUE, formats the table using knitr::kable() with the specified format. This is useful for R Markdown documents and reports. The kable_format parameter controls output format:

  • "pipe": Markdown pipe format (best for GitHub/Markdown)

  • "simple": Minimal formatting (plain text)

  • "latex": LaTeX format (for PDF reports)

  • "html": HTML format (for web display)

All columns are left-aligned for improved readability across all formats.

References

Liu S. and Yuan, Y. (2015). Bayesian Optimal Interval Designs for Phase I Clinical Trials. Journal of the Royal Statistical Society: Series C, 64, 507-523.

Examples

Run this code
if (FALSE) {
# Create multi-scenario simulation results
scenarios <- list(
  list(name = "Scenario 1",
       p_true = c(0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45)),
  list(name = "Scenario 2",
       p_true = c(0.01, 0.025, 0.05, 0.075, 0.10, 0.125, 0.15, 0.20, 0.30))
)

result <- sim_boin_multi(
  scenarios = scenarios,
  target = 0.30,
  n_trials = 1000,
  n_cohort = 48,
  cohort_size = 3,
  seed = 123
)

# Print as plain text with absolute numbers (default)
print(result)

# Print with absolute numbers as Markdown table
print(result, kable = TRUE, kable_format = "pipe")

# Print with percentages instead of absolute numbers
print(result, percent = TRUE)

# Print with percentages as Markdown table
print(result, kable = TRUE, kable_format = "pipe", percent = TRUE)

# Print as LaTeX table for PDF documents
print(result, kable = TRUE, kable_format = "latex")

# Print as HTML table
print(result, kable = TRUE, kable_format = "html")
}

Run the code above in your browser using DataLab