Add an already calculated table to the layout
Arguments
- lyt
layout object pre-data used for tabulation
- tt
TableTree
(or related class). ATableTree
object representing a populated table.- indent_mod
numeric. Modifier for the default indent position for the structure created by this function(subtable, content table, or row) and all of that structure's children. Defaults to 0, which corresponds to the unmodified default behavior.
Value
A PreDataTableLayouts
object suitable for passing to further
layouting functions, and to build_table
.
Examples
lyt1 <- basic_table() %>%
split_cols_by("ARM") %>%
analyze("AGE", afun = mean, format = "xx.xx")
tbl1 <- build_table(lyt1, DM)
tbl1
#> A: Drug X B: Placebo C: Combination
#> ——————————————————————————————————————————————
#> mean 34.91 33.02 34.57
lyt2 <- basic_table() %>% split_cols_by("ARM") %>%
analyze("AGE", afun = sd, format = "xx.xx") %>%
add_existing_table(tbl1)
tbl2 <- build_table(lyt2, DM)
tbl2
#> A: Drug X B: Placebo C: Combination
#> ——————————————————————————————————————————————
#> sd 7.79 6.34 6.50
#> mean 34.91 33.02 34.57
table_structure(tbl2)
#> [TableTree] root
#> [ElementaryTable] AGE (1 x 3)
#> [ElementaryTable] AGE (1 x 3)
row_paths_summary(tbl2)
#> rowname node_class path
#> ————————————————————————————————————————
#> sd DataRow root, AGE, sd
#> mean DataRow root, AGE, mean