Learn R Programming

dtlg (version 0.0.2)

summary_table_by: Create a summary table using multiple rows for grouping on one target column

Description

Create a summary table using multiple rows for grouping on one target column

Usage

summary_table_by(
  dt,
  target,
  treat,
  rows_by,
  indent = nbsp(n = 4L),
  .total_dt = dt,
  pct_dec = 1,
  treat_order = NULL,
  skip_absent = TRUE
)

Value

The same output as summary_table() except that folded by variables indicated in rows_by.

Arguments

dt

A data.frame containing, at least, the variables indicated in target and treat.

target

Target variable passed as a string for which summary statistics are to be calculated.

treat

A string indicating the grouping variable, e.g. the variable specifying the treatment population.

rows_by

string, grouping variable to split events by.

indent

A string to be used as indentation of summary statistics labels. Defaults to four HTML non-breaking spaces ( ).

.total_dt

Separate table from dt from which to derive total counts per group.

pct_dec

Decimal places for reported figures.

treat_order

Customise the column order of the output table.

skip_absent

Whether to ignore variables passed in treat_order that are absent from dt. Default is TRUE; FALSE will throw an error in case there are missing variables.

Examples

Run this code
summary_table_by(adlb, target = "AVAL", treat = "ARM", rows_by = c("PARAM","AVISIT"))

Run the code above in your browser using DataLab