Create a summary table using multiple rows for grouping on one target column
summary_table_by.Rd
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
)
Arguments
- dt
A
data.frame
containing, at least, the variables indicated intarget
andtreat
.- 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 fromdt
. Default isTRUE
;FALSE
will throw an error in case there are missing variables.
Value
The same output as summary_table()
except that folded by variables
indicated in rows_by
.
Examples
summary_table_by(adlb, target = "AVAL", treat = "ARM", rows_by = c("PARAM","AVISIT"))
#> [[1]]
#> stats A: Drug X
#> <char> <char>
#> 1: Alanine Aminotransferase Measurement <NA>
#> 2: SCREENING
#> 3: n 134
#> 4: Mean (SD) 18.2 (8.5)
#> 5: Median 17.6
#> ---
#> 125: n 134
#> 126: Mean (SD) 2.9 (0.1)
#> 127: Median 2.9
#> 128: Min, Max 2.6, 3.1
#> 129: Missing 0
#> B: Placebo C: Combination
#> <char> <char>
#> 1: <NA> <NA>
#> 2:
#> 3: 134 132
#> 4: 19.3 (9.8) 18.5 (9.1)
#> 5: 18.1 17.6
#> ---
#> 125: 134 132
#> 126: 2.9 (0.1) 2.9 (0.1)
#> 127: 2.9 2.9
#> 128: 2.6, 3.1 2.6, 3.1
#> 129: 0 0
#>