Group rule pack is a rule pack which defines a set of rules for groups of rows as a whole, i.e. functions which convert groups of interest to logical values. It should return a data frame with the following properties:
There should be present some columns which combined values uniquely describe group. They should be defined during creation with group_packs().
Number of rows equals to number of checked groups.
Names of non-grouping columns should be treated as rule names.
Values indicate whether the group as a whole follows the rule.
This format is inspired by
dplyr's summarise() applied
to grouped data.
The most common way to define data pack is by creating a functional sequence with grouping and ending with
Group pack output is interpreted in the following way:
Levels of the resulting column are treated as names of some new variables which should be exposed as a whole. Names of non-grouping columns are treated as rule names. They are transformed in column pack format and interpreted accordingly.
Exposure result of group pack is different from others in a way that column
var in exposure report doesn't represent the actual column
vs_am_rules <- . %>% dplyr::group_by(vs, am) %>% dplyr::summarise(nrow_low = n(.) > 10, nrow_up = n(.) < 20, rowmeans_low = rowMeans(.) > 19) group_packs(vs_am = vs_am_rules, .group_vars = c("vs", "am"))#> $vs_am #> A Group rule pack: #> Functional sequence with the following components: #> #> 1. dplyr::group_by(., vs, am) #> 2. dplyr::summarise(., nrow_low = n(.) > 10, nrow_up = n(.) < 20, rowmeans_low = rowMeans(.) > 19) #> #> Use 'functions' to extract the individual functions. #>