View source: R/count_missed_doses.R
count_missed_doses | R Documentation |
The analyze function creates a layout element to calculate cumulative counts of patients with number of missed doses at least equal to user-specified threshold values.
This function analyzes numeric variable vars
, a variable with numbers of missed doses,
against the threshold values supplied to the thresholds
argument as a numeric vector. This function
assumes that every row of the given data frame corresponds to a unique patient.
count_missed_doses(
lyt,
vars,
thresholds,
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_nonmissing(x)
s_count_missed_doses(x, thresholds, .N_col)
a_count_missed_doses(x, thresholds, .N_col)
lyt |
( |
vars |
( |
thresholds |
( |
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_missed_doses()
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_missed_doses()
to the table layout.
s_count_nonmissing()
returns the statistic n
which is the count of non-missing values in x
.
s_count_missed_doses()
returns the statistics n
and count_fraction
with one element for each threshold.
a_count_missed_doses()
returns the corresponding list with formatted rtables::CellValue()
.
count_missed_doses()
: Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_nonmissing()
: Statistics function to count non-missing values.
s_count_missed_doses()
: Statistics function to count patients with missed doses.
a_count_missed_doses()
: Formatted analysis function which is used as afun
in count_missed_doses()
.
Relevant description function d_count_missed_doses()
which generates labels for count_missed_doses()
.
Similar analyze function count_cumulative()
which more generally counts cumulative values and has more
options for threshold handling, but uses different labels.
library(dplyr)
anl <- tern_ex_adsl %>%
distinct(STUDYID, USUBJID, ARM) %>%
mutate(
PARAMCD = "TNDOSMIS",
PARAM = "Total number of missed doses during study",
AVAL = sample(0:20, size = nrow(tern_ex_adsl), replace = TRUE),
AVALC = ""
)
basic_table() %>%
split_cols_by("ARM") %>%
add_colcounts() %>%
count_missed_doses("AVAL", thresholds = c(1, 5, 10, 15), var_labels = "Missed Doses") %>%
build_table(anl, alt_counts_df = tern_ex_adsl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.