Call audit_cols_minimal()
within your audit()
methods for
the output of consistency test mapper functions such as grim_map()
. It
will create a tibble with the three minimal, required columns:
incons_cases
counts the inconsistent cases, i.e., the number of rows in the mapper's output where"consistency"
isFALSE
.all_cases
is the total number of rows in the mapper's output.incons_rate
is the ratio ofincons_cases
toall_cases
.
You can still add other columns to this tibble. Either way, make sure to name your method correctly. See examples.
Arguments
- data
Data frame returned by a mapper function, such as
grim_map()
.- name_test
String (length 1). Short, plain-text name of the consistency test, such as
"GRIM"
. Only needed for a potential alert.
See also
For context, see vignette("consistency-tests-in-depth")
. In case
you don't call audit_cols_minimal()
, you should call
check_audit_special()
.
Examples
# For a mapper function called `schlim_map()`
# that applies a test called SCHLIM and returns
# a data frame with the `"scr_schlim_map"` class:
audit.scr_schlim_map <- function(data) {
audit_cols_minimal(data, name_test = "SCHLIM")
}
# If you like, add other summary columns
# with `dplyr::mutate()` or similar.