Learn R Programming

rtables (version 0.4.0)

add_overall_level: Add an virtual 'overall' level to split

Description

Add an virtual 'overall' level to split

Usage

add_overall_level(
  valname = "Overall",
  label = valname,
  extra_args = list(),
  first = TRUE,
  trim = FALSE
)

Arguments

valname

character(1). 'Value' to be assigned to the implicit all-observations split level. Defaults to "Overall"

label

character(1). A label (not to be confused with the name) for the object/structure.

extra_args

list. Extra arguments to be passed to the tabulation function. Element position in thte 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 ttabulation function.

first

logical(1). Should the implicit level appear first (TRUE) or last FALSE. Defaults to TRUE.

trim

logical(1). Should splits corresponding with 0 observations be kept when tabulating.

Value

a closure suitable for use as a splitting function (splfun) when creating a table layout

Examples

Run this code
# NOT RUN {
l <- basic_table() %>%
   split_cols_by("ARM", split_fun = add_overall_level("All Patients", first = FALSE)) %>%
   analyze("AGE")

build_table(l, DM)


l <- 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")

l

build_table(l, DM)

# }

Run the code above in your browser using DataLab