audit: Summarize scrutiny objects

View source: R/audit.R

auditR Documentation

Summarize scrutiny objects

Description

audit() summarizes the output of scrutiny functions that test data frames, such as grim_map(). It is an S3 generic with methods for the functions listed below. The columns of each summary are described in the documentation of the respective function.

On the output of a sequence or total-n mapper, such as grim_map_seq(), it returns one row per case; see audit-special.

Usage

audit(data, ..., .by = NULL)

Arguments

data

A data frame returned by one of the functions below.

...

These dots must be empty.

.by

Optionally, columns of data to summarize by, selected as in dplyr::select(), such as .by = study. Each group is summarized on its own, and its rows start with the grouping columns. Groups appear in the order of their first row. Use this rather than dplyr::group_by(), which removes the class that audit() dispatches on.

Value

A tibble with summary statistics.

Run before audit()

Function Class
grim_map() "scrutiny_grim_map"
grimmer_map() "scrutiny_grimmer_map"
debit_map() "scrutiny_debit_map"
percentage_of_map() "scrutiny_percentage_of_map"
add_up_to_map() "scrutiny_add_up_to_map"
⁠*_map_seq()⁠ functions "scrutiny_map_seq"
⁠*_map_total_n()⁠ functions "scrutiny_map_total_n"
duplicate_count() "scrutiny_dup_count"
duplicate_count_colpair() "scrutiny_dup_count_colpair"
duplicate_tally() "scrutiny_dup_tally"
audit() on seq output "scrutiny_audit_seq"
audit() on total-n output "scrutiny_audit_total_n"

Examples

pigs1 |>
  grim_map(digits_x = 2, items_averaged = 1, data_type = "integer") |>
  audit()

pigs4 |>
  duplicate_count() |>
  audit()

# Summaries by group:
pigs1 |>
  grim_map(digits_x = 2, items_averaged = 1, data_type = "integer") |>
  dplyr::mutate(study = rep(c("A", "B", "C"), each = 4)) |>
  audit(.by = study)

scrutiny documentation built on Nov. 11, 2026, 1:09 a.m.