3 Stratifying and combining tables
3.1 Stratified tables: tbl_strata()
Use this when you want to “place side by side tables comparing treatment groups within each grade”.
strata: the variable to stratify by.tbl_fun: the table to build from each stratum’s data.x. Written in the form~ .x |> ...- The per-stratum tables are merged side by side, with the stratum name (a spanner) on top
The warning cannot compute exact confidence intervals with ties means that in the Wilcoxon test “the exact confidence interval cannot be computed because there are identical values (ties)”. It does not affect the p-values shown in the table, so you need not worry about it here.
3.1.1 Changing the stratum headers: .header
{strata} is replaced by the stratum value and {n} by the stratum size. Surrounding text with ** makes it bold.
3.1.2 Stacking vertically: .combine_with
3.2 Placing tables side by side: tbl_merge()
Merges separately built tables side by side. For example, placing summaries for “tumor response” and “death” next to each other:
tbl_merge() matches rows by variable name and label. Make sure the variables and labels of the tables being merged are consistent.
3.3 Stacking tables vertically: tbl_stack()
3.4 Cross-tabulations: tbl_cross()
Builds a contingency table of two categorical variables.
3.5 Summarizing a continuous variable by groups: tbl_continuous()
Summarizes a single continuous variable by two categorical variables, as in “median age by grade × treatment group”.
tbl_strata(): build the same table for each stratum and place them side by side (or stack them)tbl_merge(): merge separate tables side by side;tab_spannerfor top headerstbl_stack(): stack separate tables vertically;group_headerfor dividing headerstbl_cross()(contingency tables),tbl_continuous()(summarize a continuous variable by category × group)