Bridge function for converting tbl_hierarchical()
(and similar) cards to basic gtsummary objects.
All bridge functions begin with prefix brdg_*()
.
This file also contains helper functions for constructing the bridge,
referred to as the piers (supports for a bridge) and begin with pier_*()
.
brdg_hierarchical()
: The bridge function ingests an ARD data frame and returns
a gtsummary table that includes .$table_body
and a basic .$table_styling
.
The .$table_styling$header
data frame includes the header statistics.
Based on context, this function adds a column to the ARD data frame named
"gts_column"
. This column is used during the reshaping in the pier_*()
functions defining column names.
pier_*()
: these functions accept a cards tibble and returns a tibble
that is a piece of the .$table_body
. Typically these will be stacked
to construct the final table body data frame. The ARD object passed here
will have two primary parts: the calculated summary statistics and the
attributes ARD. The attributes ARD is used for labeling. The ARD data frame
passed to this function must include a "gts_column"
column, which is
added in brdg_hierarchical()
.
brdg_hierarchical(
cards,
variables,
by,
include,
statistic,
overall_row,
count,
is_ordered,
label
)
pier_summary_hierarchical(cards, variables, include, statistic)
(card
)
an ARD object of class "card"
created with cards::ard_hierarchical_stack()
.
(character
)
character list of hierarchy variables.
(string
)
string indicating the stratifying column.
(character
)
character list of hierarchy variables to include summary statistics for.
(named list
)
named list of summary statistic names.
(scalar logical
)
whether an overall summary row should be included at the top of the table.
The default is FALSE
.
(scalar logical
)
whether tbl_hierarchical_count()
(TRUE
) or tbl_hierarchical()
(FALSE
) is being applied.
(scalar logical
)
whether the last variable in variables
is ordered.
(named list
)
named list of hierarchy variable labels.
a gtsummary object
Review list, formula, and selector syntax used throughout gtsummary