View source: R/count_cumulative.R
count_cumulative | R Documentation |
The analyze function count_cumulative()
creates a layout element to calculate cumulative counts of values in a
numeric variable that are less than, less or equal to, greater than, or greater or equal to user-specified
threshold values.
This function analyzes numeric variable vars
against the threshold values supplied to the thresholds
argument as a numeric vector. Whether counts should include the threshold values, and whether to count
values lower or higher than the threshold values can be set via the include_eq
and lower_tail
parameters, respectively.
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,
...
)
lyt |
( |
vars |
( |
thresholds |
( |
lower_tail |
( |
include_eq |
( |
var_labels |
( |
show_labels |
( |
na_str |
( |
nested |
( |
... |
additional arguments for the lower level functions. |
table_names |
( |
.stats |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
x |
( |
.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_fraction
s: 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()
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.