Group by count, sum, percent and zscore - datatable variant.
count_percent_zscore_dt.RdThis function can be used to perform a number of mathematical operation on a datatable. Count or sum numerical values by group, get percent breakdown of counts or sums by group, and get optional zscore of values.
Usage
count_percent_zscore_dt(
data,
grp_c = ...,
grp_p = ...,
grp_z = ...,
col,
prefix = NULL,
rnd = NULL,
cntr_scl = FALSE
)Arguments
- data
a datatable
- grp_c
a vector of columns to group counting operation with - do not quote columns
- grp_p
a vector of columns to group percent calculation operation with - do not quote columns
- grp_z
a vector of columns to group zscore calculation operation with - do not quote columns
- col
a string indicating which column to count or sum
- prefix
a string used to prefix calculated columns with - leave empty if you do not want a prefix
- rnd
integer indicating how many digits you want calculated columns to be rounded to - leave empty if you do not want rounding
- cntr_scl
(`TRUE`/`FALSE`) boolean to indicate if zscore should be calculated - default is `FALSE`