A tibble representing the data validation result of certain data units in tidy way:

  • pack <chr> : Name of rule pack from column 'name' of corresponding packs_info object.

  • rule <chr> : Name of the rule defined in rule pack.

  • var <chr> : Name of the variable which validation result is reported. Value '.all' is reserved and interpreted as 'all columns as a whole'. Note that var doesn't always represent the actual column in data frame (see group packs).

  • id <int> : Index of the row in tested data frame which validation result is reported. Value 0 is reserved and interpreted as 'all rows as a whole'.

  • value <lgl> : Whether the described data unit obeys the rule.

is_report(.x, .skip_class = FALSE)

get_report(.object)

Arguments

.x

Object to test.

.skip_class

Whether to skip checking inheritance from ruler_report.

.object

Object to get report value from exposure attribute.

Value

get_report() returns report element of object if it is exposure and of its 'exposure' attribute otherwise.

Details

There are four basic combinations of var and id values which define five basic data units:

  • var == '.all' and id == 0: Data as a whole.

  • var != '.all' and id == 0: Group (var shouldn't be an actual column name) or column (var should be an actual column name) as a whole.

  • var == '.all' and id != 0: Row as a whole.

  • var != '.all' and id != 0: Described cell.

Examples

my_row_packs <- row_packs(
  row_mean_props = . %>% dplyr::transmute(row_mean = rowMeans(.)) %>%
    dplyr::transmute(
      row_mean_low = row_mean > 20,
      row_mean_high = row_mean < 60
    ),
  row_outlier = . %>% dplyr::transmute(row_sum = rowSums(.)) %>%
    dplyr::transmute(
      not_row_outlier = abs(row_sum - mean(row_sum)) / sd(row_sum) < 1.5
    )
)
my_data_packs <- data_packs(
  data_dims = . %>% dplyr::summarise(
    nrow = nrow(.) == 32,
    ncol = ncol(.) == 5
  )
)

mtcars_exposed <- mtcars %>%
  expose(my_data_packs, .remove_obeyers = FALSE) %>%
  expose(my_row_packs)

mtcars_exposed %>% get_report()
#> Tidy data validation report:
#> # A tibble: 14 × 5
#>    pack           rule            var      id value
#>    <chr>          <chr>           <chr> <int> <lgl>
#>  1 data_dims      nrow            .all      0 TRUE 
#>  2 data_dims      ncol            .all      0 FALSE
#>  3 row_mean_props row_mean_low    .all     18 FALSE
#>  4 row_mean_props row_mean_low    .all     19 FALSE
#>  5 row_mean_props row_mean_low    .all     20 FALSE
#>  6 row_mean_props row_mean_low    .all     26 FALSE
#>  7 row_mean_props row_mean_high   .all     15 FALSE
#>  8 row_mean_props row_mean_high   .all     16 FALSE
#>  9 row_mean_props row_mean_high   .all     17 FALSE
#> 10 row_mean_props row_mean_high   .all     29 FALSE
#> 11 row_mean_props row_mean_high   .all     31 FALSE
#> 12 row_outlier    not_row_outlier .all     15 FALSE
#> 13 row_outlier    not_row_outlier .all     16 FALSE
#> 14 row_outlier    not_row_outlier .all     17 FALSE

mtcars_exposed %>%
  get_report() %>%
  is_report()
#> [1] TRUE