Row rule pack is a rule pack which defines a set of rules for rows as a whole, i.e. functions which convert rows of interest to logical values. It should return a data frame with the following properties:

  • Number of rows equals to number of checked rows.

  • Column names should be treated as rule names.

  • Values indicate whether the row as a whole follows the rule.

Details

This format is inspired by dplyr's transmute().

The most common way to define row pack is by creating a functional sequence containing transmute(...).

Note about rearranging rows

Note that during exposure packs are applied to keyed object with id key. So they can rearrange rows as long as it is done with functions supported by keyholder. Rows will be tracked and recognized as in the original data frame of interest.

Examples

some_row_mean_rules <- . %>%
  dplyr::slice(1:3) %>%
  dplyr::mutate(row_mean = rowMeans(.)) %>%
  dplyr::transmute(
    row_mean_low = row_mean > 10,
    row_mean_up = row_mean < 20
  )
all_row_sum_rules <- . %>%
  dplyr::mutate(row_sum = rowSums(.)) %>%
  dplyr::transmute(row_sum_low = row_sum > 30)

row_packs(
  some_row_mean_rules,
  all_row_sum_rules
)
#> [[1]]
#> A Row rule pack:
#> Functional sequence with the following components:
#> 
#>  1. dplyr::slice(., 1:3)
#>  2. dplyr::mutate(., row_mean = rowMeans(.))
#>  3. dplyr::transmute(., row_mean_low = row_mean > 10, row_mean_up = row_mean <     20)
#> 
#> Use 'functions' to extract the individual functions. 
#> 
#> [[2]]
#> A Row rule pack:
#> Functional sequence with the following components:
#> 
#>  1. dplyr::mutate(., row_sum = rowSums(.))
#>  2. dplyr::transmute(., row_sum_low = row_sum > 30)
#> 
#> Use 'functions' to extract the individual functions. 
#>