ruler-report: Tidy data validation report

ruler-reportR Documentation

Tidy data validation report

Description

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.

Usage

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.

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.

Value

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

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

mtcars_exposed %>%
  get_report() %>%
  is_report()

ruler documentation built on March 31, 2023, 8:13 p.m.