Learn R Programming

ruler (version 0.3.0)

group-pack: Group rule pack

Description

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.

Arguments

Interpretation

Group pack output is interpreted in the following way:

  • All grouping columns are united with delimiter .group_sep (which is an argument of group_packs()).

  • 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 in data.

Details

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 summarise(...).

See Also

Data pack, Column pack, row pack, cell pack.

Examples

Run this code
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"))

Run the code above in your browser using DataLab