Convert a summary table object created with as_table
to a gt_tbl
object; currently only implemented for
gsBinomialExact
.
Usage
as_gt(x, ...)
# S3 method for gsBinomialExactTable
as_gt(
x,
...,
title = "Operating Characteristics for the Truncated SPRT Design",
subtitle = "Assumes trial evaluated sequentially after each response",
theta_label = html("Underlying<br>response rate"),
bound_label = c("Futility bound", "Efficacy bound"),
prob_decimals = 2,
en_decimals = 1,
rr_decimals = 0
)
Arguments
- x
Object to be converted.
- ...
Other parameters that may be specific to the object.
- title
Table title.
- subtitle
Table subtitle.
- theta_label
Label for theta.
- bound_label
Label for bounds.
- prob_decimals
Number of decimal places for probability of crossing.
- en_decimals
Number of decimal places for expected number of observations when bound is crossed or when trial ends without crossing.
- rr_decimals
Number of decimal places for response rates.
Details
Currently only implemented for gsBinomialExact
objects.
Creates a table to summarize an object.
For gsBinomialExact
, this summarized operating characteristics
across a range of effect sizes.
Examples
safety_design <- binomialSPRT(
p0 = .04, p1 = .1, alpha = .04, beta = .2, minn = 4, maxn = 75
)
safety_power <- gsBinomialExact(
k = length(safety_design$n.I),
theta = seq(.02, .16, .02),
n.I = safety_design$n.I,
a = safety_design$lower$bound,
b = safety_design$upper$bound
)
safety_power %>%
as_table() %>%
as_gt(
theta_label = gt::html("Underlying<br>AE rate"),
prob_decimals = 3,
bound_label = c("low rate", "high rate")
)
#> <div id="mwlefoodfi" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>#mwlefoodfi table {
#> font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
#> -webkit-font-smoothing: antialiased;
#> -moz-osx-font-smoothing: grayscale;
#> }
#>
#> #mwlefoodfi thead, #mwlefoodfi tbody, #mwlefoodfi tfoot, #mwlefoodfi tr, #mwlefoodfi td, #mwlefoodfi th {
#> border-style: none;
#> }
#>
#> #mwlefoodfi p {
#> margin: 0;
#> padding: 0;
#> }
#>
#> #mwlefoodfi .gt_table {
#> display: table;
#> border-collapse: collapse;
#> line-height: normal;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_caption {
#> padding-top: 4px;
#> padding-bottom: 4px;
#> }
#>
#> #mwlefoodfi .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #mwlefoodfi .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 3px;
#> padding-bottom: 5px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #mwlefoodfi .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #mwlefoodfi .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #mwlefoodfi .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #mwlefoodfi .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #mwlefoodfi .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #mwlefoodfi .gt_spanner_row {
#> border-bottom-style: hidden;
#> }
#>
#> #mwlefoodfi .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> text-align: left;
#> }
#>
#> #mwlefoodfi .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #mwlefoodfi .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #mwlefoodfi .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #mwlefoodfi .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #mwlefoodfi .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #mwlefoodfi .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #mwlefoodfi .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #mwlefoodfi .gt_row_group_first th {
#> border-top-width: 2px;
#> }
#>
#> #mwlefoodfi .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #mwlefoodfi .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #mwlefoodfi .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #mwlefoodfi .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_last_grand_summary_row_top {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: double;
#> border-bottom-width: 6px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #mwlefoodfi .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #mwlefoodfi .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #mwlefoodfi .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #mwlefoodfi .gt_left {
#> text-align: left;
#> }
#>
#> #mwlefoodfi .gt_center {
#> text-align: center;
#> }
#>
#> #mwlefoodfi .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #mwlefoodfi .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #mwlefoodfi .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #mwlefoodfi .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #mwlefoodfi .gt_super {
#> font-size: 65%;
#> }
#>
#> #mwlefoodfi .gt_footnote_marks {
#> font-size: 75%;
#> vertical-align: 0.4em;
#> position: initial;
#> }
#>
#> #mwlefoodfi .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #mwlefoodfi .gt_indent_1 {
#> text-indent: 5px;
#> }
#>
#> #mwlefoodfi .gt_indent_2 {
#> text-indent: 10px;
#> }
#>
#> #mwlefoodfi .gt_indent_3 {
#> text-indent: 15px;
#> }
#>
#> #mwlefoodfi .gt_indent_4 {
#> text-indent: 20px;
#> }
#>
#> #mwlefoodfi .gt_indent_5 {
#> text-indent: 25px;
#> }
#> </style>
#> <table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
#> <thead>
#> <tr class="gt_heading">
#> <td colspan="4" class="gt_heading gt_title gt_font_normal" style>Operating Characteristics for the Truncated SPRT Design</td>
#> </tr>
#> <tr class="gt_heading">
#> <td colspan="4" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border" style>Assumes trial evaluated sequentially after each response</td>
#> </tr>
#> <tr class="gt_col_headings gt_spanner_row">
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="2" colspan="1" scope="col" id="Underlying<br>AE rate">Underlying<br>AE rate</th>
#> <th class="gt_center gt_columns_top_border gt_column_spanner_outer" rowspan="1" colspan="2" scope="colgroup" id="Probability of crossing">
#> <span class="gt_column_spanner">Probability of crossing</span>
#> </th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="2" colspan="1" scope="col" id="Average<br>sample size">Average<br>sample size</th>
#> </tr>
#> <tr class="gt_col_headings">
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="low rate">low rate</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="high rate">high rate</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr><td headers="theta" class="gt_row gt_right">2%</td>
#> <td headers="Lower" class="gt_row gt_right">0.964</td>
#> <td headers="Upper" class="gt_row gt_right">0.001</td>
#> <td headers="en" class="gt_row gt_right">34.8</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">4%</td>
#> <td headers="Lower" class="gt_row gt_right">0.769</td>
#> <td headers="Upper" class="gt_row gt_right">0.019</td>
#> <td headers="en" class="gt_row gt_right">46.4</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">6%</td>
#> <td headers="Lower" class="gt_row gt_right">0.506</td>
#> <td headers="Upper" class="gt_row gt_right">0.108</td>
#> <td headers="en" class="gt_row gt_right">54.3</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">8%</td>
#> <td headers="Lower" class="gt_row gt_right">0.291</td>
#> <td headers="Upper" class="gt_row gt_right">0.290</td>
#> <td headers="en" class="gt_row gt_right">56.1</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">10%</td>
#> <td headers="Lower" class="gt_row gt_right">0.155</td>
#> <td headers="Upper" class="gt_row gt_right">0.516</td>
#> <td headers="en" class="gt_row gt_right">52.8</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">12%</td>
#> <td headers="Lower" class="gt_row gt_right">0.079</td>
#> <td headers="Upper" class="gt_row gt_right">0.714</td>
#> <td headers="en" class="gt_row gt_right">46.8</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">14%</td>
#> <td headers="Lower" class="gt_row gt_right">0.039</td>
#> <td headers="Upper" class="gt_row gt_right">0.851</td>
#> <td headers="en" class="gt_row gt_right">40.2</td></tr>
#> <tr><td headers="theta" class="gt_row gt_right">16%</td>
#> <td headers="Lower" class="gt_row gt_right">0.020</td>
#> <td headers="Upper" class="gt_row gt_right">0.930</td>
#> <td headers="en" class="gt_row gt_right">34.2</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>