Summarize cumulative counts of a numeric vector that is less than, less or equal to,
greater than, or greater or equal to user-specific thresholds.
count_cumulative(
lyt,
vars,
thresholds,
lower_tail = TRUE,
include_eq = TRUE,
var_labels = vars,
show_labels = "visible",
na_str = default_na_str(),
nested = TRUE,
...,
table_names = vars,
.stats = NULL,
.formats = NULL,
.labels = NULL,
.indent_mods = NULL
)s_count_cumulative(
x,
thresholds,
lower_tail = TRUE,
include_eq = TRUE,
.N_col,
...
)
a_count_cumulative(
x,
thresholds,
lower_tail = TRUE,
include_eq = TRUE,
.N_col,
...
)
count_cumulative() returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table(). Adding this function to an rtable layout will add formatted rows containing
the statistics from s_count_cumulative() to the table layout.
s_count_cumulative() returns a named list of count_fractions: a list with each thresholds value as a
component, each component containing a vector for the count and fraction.
a_count_cumulative() returns the corresponding list with formatted rtables::CellValue().
(PreDataTableLayouts)
layout that analyses will be added to.
(character)
variable names for the primary analysis variable to be iterated over.
(numeric)
vector of cutoff values for the counts.
(flag)
whether to count lower tail, default is TRUE.
(flag)
whether to include value equal to the threshold in
count, default is TRUE.
(character)
variable labels.
(string)
label visibility: one of "default", "visible" and "hidden".
(string)
string used to replace all NA or empty values in the output.
(flag)
whether this layout instruction should be applied within the existing layout structure _if
possible (TRUE, the default) or as a new top-level element (FALSE). Ignored if it would nest a split.
underneath analyses, which is not allowed.
additional arguments for the lower level functions.
(character)
this can be customized in the case that the same vars are analyzed multiple
times, to avoid warnings from rtables.
(character)
statistics to select for the table. Run get_stats("count_cumulative")
to see available statistics for this function.
(named character or list)
formats for the statistics. See Details in analyze_vars for more
information on the "auto" setting.
(named character)
labels for the statistics (without indent).
(named integer)
indent modifiers for the labels. Defaults to 0, which corresponds to the
unmodified default behavior. Can be negative.
(numeric)
vector of numbers we want to analyze.
(integer(1))
column-wise N (column count) for the full column being analyzed that is typically
passed by rtables.
count_cumulative(): Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze().
s_count_cumulative(): Statistics function that produces a named list given a numeric vector of thresholds.
a_count_cumulative(): Formatted analysis function which is used as afun
in count_cumulative().
Relevant helper function h_count_cumulative(), and descriptive function d_count_cumulative().
basic_table() %>%
split_cols_by("ARM") %>%
add_colcounts() %>%
count_cumulative(
vars = "AGE",
thresholds = c(40, 60)
) %>%
build_table(tern_ex_adsl)
Run the code above in your browser using DataLab