Skip to contents

[Stable]

These are specific functions to count patients with missed doses. The difference to count_cumulative() is mainly the special labels.

Usage

s_count_nonmissing(x)

s_count_missed_doses(x, thresholds, .N_col)

a_count_missed_doses(x, thresholds, .N_col)

count_missed_doses(
  lyt,
  vars,
  var_labels = vars,
  show_labels = "visible",
  ...,
  table_names = vars,
  .stats = NULL,
  .formats = NULL,
  .labels = NULL,
  .indent_mods = NULL
)

Arguments

x

(numeric)
vector of numbers we want to analyze.

thresholds

(vector of count)
number of missed doses the patients at least had.

.N_col

(count)
row-wise N (row group count) for the group of observations being analyzed (i.e. with no column-based subsetting) that is passed by rtables.

lyt

(layout)
input layout where analyses will be added to.

vars

(character)
variable names for the primary analysis variable to be iterated over.

var_labels

(character)
character for label.

show_labels

(string)
label visibility: one of "default", "visible" and "hidden".

...

additional arguments for the lower level functions.

table_names

(character)
this can be customized in case that the same vars are analyzed multiple times, to avoid warnings from rtables.

.stats

(character)
statistics to select for the table.

.formats

(named character or list)
formats for the statistics.

.labels

(named character)
labels for the statistics (without indent).

.indent_mods

(named integer)
indent modifiers for the labels. Defaults to 0, which corresponds to the unmodified default behavior. Can be negative.

Value

  • 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.

  • 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.

Functions

  • 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().

  • count_missed_doses(): Layout-creating function which can take statistics function arguments and additional format arguments. This function is a wrapper for rtables::analyze().

See also

Relevant description function d_count_missed_doses().

Examples

set.seed(1)
x <- c(sample(1:10, 10), NA)

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)
#>                              A: Drug X    B: Placebo   C: Combination
#>                                (N=69)       (N=73)         (N=58)    
#> —————————————————————————————————————————————————————————————————————
#> Missed Doses                                                         
#>   n                              69           73             58      
#>   At least 1 missed dose     65 (94.2%)   67 (91.8%)     58 (100%)   
#>   At least 5 missed doses    54 (78.3%)   51 (69.9%)     54 (93.1%)  
#>   At least 10 missed doses   31 (44.9%)   40 (54.8%)     31 (53.4%)  
#>   At least 15 missed doses   17 (24.6%)   23 (31.5%)     20 (34.5%)