
Last chance! 50% off unlimited learning
Sale ends in
Add an virtual 'overall' level to split
add_overall_level(
valname = "Overall",
label = valname,
extra_args = list(),
first = TRUE,
trim = FALSE
)
a closure suitable for use as a splitting function (splfun
)
when creating a table layout
character(1). 'Value' to be assigned to the implicit
all-observations split level. Defaults to "Overall"
character(1). A label (not to be confused with the name) for the object/structure.
list. Extra arguments to be passed to the tabulation function. Element position in the list corresponds to the children of this split. Named elements in the child-specific lists are ignored if they do not match a formal argument of the tabulation function.
logical(1). Should the implicit level appear first (TRUE
)
or last FALSE
. Defaults to TRUE
.
logical(1). Should splits corresponding with 0 observations be kept when tabulating.
lyt <- basic_table() %>%
split_cols_by("ARM", split_fun = add_overall_level("All Patients",
first = FALSE)) %>%
analyze("AGE")
tbl <- build_table(lyt, DM)
tbl
lyt2 <- basic_table() %>%
split_cols_by("ARM") %>%
split_rows_by("RACE",
split_fun = add_overall_level("All Ethnicities")) %>%
summarize_row_groups(label_fstr = "%s (n)") %>%
analyze("AGE")
lyt2
tbl2 <- build_table(lyt2, DM)
tbl2
Run the code above in your browser using DataLab