Learn R Programming

dtlg (version 0.0.2)

tern_summary_table: Create a clinical reporting table with tern/rtables

Description

tern_summary_table() is a convenience wrapper around {rtables} and {tern} commands to generate a clinical reporting summary statistics tables whilst using a similar interface as summary_table(). This can be helpful for side by side comparisons of the two functions.

Usage

tern_summary_table(dt, target, treat, target_name = target)

Value

A data.table of summary statistics. The format depends on the type of the target variable:

  • If the target variable is categorical, i.e. type character, factor or logical then the output is that of calc_counts().

  • If the target variable is numeric, then the output is that of calc_desc().

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.

target_name

Heading for the target variable as a string. Defaults to target.

See Also

summary_table()

Examples

Run this code
dmg_vars <- c("AGE", "RACE", "ETHNIC")
dmg_var_lbls <- c("Age (yr)", "Race", "Ethnicity")

# Demographics table (DMT01)
tern_summary_table(
  adsl,
  target = dmg_vars,
  treat = 'ARM',
  target_name = dmg_var_lbls
)

# Demographics table (DMT01) with continuous variable (e.g., BMRKR1)
tern_summary_table(
  adsl,
  target = c(dmg_vars, "BMRKR1"),
  treat = 'ARM',
  target_name = c(dmg_var_lbls, "Biomarker 1")
)

Run the code above in your browser using DataLab