Data rule pack is a rule pack which defines a set of rules for data as a whole, i.e. functions which convert data to logical values. It should return a data frame with the following properties:
Number of rows equals to one.
Column names should be treated as rule names.
Values indicate whether the data as a whole follows the rule.
This format is inspired by dplyr
's summarise() applied
to non-grouped data.
The most common way to define data pack is by creating a
functional sequence with no grouping and ending with
summarise(...)
.
data_dims_rules <- . %>%
dplyr::summarise(
nrow_low = nrow(.) > 10,
nrow_up = nrow(.) < 20,
ncol_low = ncol(.) > 5,
ncol_up = ncol(.) < 10
)
data_na_rules <- . %>%
dplyr::summarise(all_not_na = Negate(anyNA)(.))
data_packs(
data_nrow = data_dims_rules,
data_na = data_na_rules
)
#> $data_nrow
#> A Data rule pack:
#> Functional sequence with the following components:
#>
#> 1. dplyr::summarise(., nrow_low = nrow(.) > 10, nrow_up = nrow(.) < 20, ncol_low = ncol(.) > 5, ncol_up = ncol(.) < 10)
#>
#> Use 'functions' to extract the individual functions.
#>
#> $data_na
#> A Data rule pack:
#> Functional sequence with the following components:
#>
#> 1. dplyr::summarise(., all_not_na = Negate(anyNA)(.))
#>
#> Use 'functions' to extract the individual functions.
#>