calc_counts() counts observations of a categorical variable (target) by
another (treat) and reports summary statistics in clinical trial reporting
format.
calc_counts(
dt,
target,
target_name = target,
treat,
indent = nbsp(n = 4L),
.total_dt = NULL,
pct_dec = 1
)A list containing a data.table formatted as follows:
First column is named stats and contains the target variable name
indicated in target in the first row. Subsequent rows contain the
levels of target.
Other columns are for the levels of the grouping variable (treat).
All columns are of character type.
This table is structured for easy integration with Shiny output widgets.
A data.frame containing, at least, the variables indicated in
target and treat.
Target variable passed as a string for which summary statistics are to be calculated.
Heading for the target variable as a string. Defaults to
target.
A string indicating the grouping variable, e.g. the variable specifying the treatment population.
A string to be used as indentation of summary statistics
labels. Defaults to four HTML non-breaking spaces ( ).
Separate table from dt from which to derive total counts
per group.
This argument is ignored, and is only kept for backward compatibility reasons.
calc_counts(dt = adsl, "RACE", treat = "ARM", indent = " ")[[1]]
Run the code above in your browser using DataLab