Learn R Programming

cards (version 0.3.0)

.calculate_tabulation_statistics: Calculate Tabulation Statistics

Description

Function takes the summary instructions from the statistic = list(variable_name = list(tabulation=c("n", "N", "p"))) argument, and returns the tabulations in an ARD structure.

Usage

.calculate_tabulation_statistics(
  data,
  variables,
  by,
  strata,
  denominator,
  statistic
)

Value

an ARD data frame of class 'card'

Arguments

data

(data.frame)
a data frame

variables

(tidy-select)
columns to include in summaries. Default is everything().

by, strata

(tidy-select)
columns to tabulate by/stratify by for tabulation. Arguments are similar, but with an important distinction:

by: results are tabulated by all combinations of the columns specified, including unobserved combinations and unobserved factor levels.

strata: results are tabulated by all observed combinations of the columns specified.

Arguments may be used in conjunction with one another.

denominator

(data.frame, integer)
Specify this optional argument to change the denominator, e.g. the "N" statistic. Default is NULL. See below for details.

statistic

(formula-list-selector)
a named list, a list of formulas, or a single formula where the list element one or more of c("n", "N", "p") (or the RHS of a formula).

Examples

Run this code
cards:::.calculate_tabulation_statistics(
  ADSL,
  variables = "ARM",
  by = NULL,
  strata = NULL,
  denominator = "cell",
  statistic = list(ARM = list(tabulation = c("N")))
)

Run the code above in your browser using DataLab