explain_map: Explain mapper results row by row

View source: R/explain-map.R

explain_mapR Documentation

Explain mapper results row by row

Description

[Experimental]

explain_map() takes the output of grim_map(), grimmer_map(), or debit_map() and adds an explanation column: the calculation behind each row's result in plain words, as printed by grim_explain(), grimmer_explain(), and debit_explain() for a single case. It also takes the output of the sequence and total-n mappers built on them, such as grim_map_seq().

To read the explanations, use explain_print().

Usage

explain_map(data, ...)

Arguments

data

Data frame returned by one of the mappers named above.

...

Must be empty for scrutiny's methods; methods for other classes may use them.

Details

Each row is tested again from its own values and the settings of the mapper call, such as rounding and x_meaning. If the result differs from the row's consistency value, the row must have been changed after testing, and explain_map() throws an error.

DEBIT explanations cover formula = "exact" only.

Value

data with an explanation column, a string per row.

Examples

pigs1 |>
  grim_map(digits_x = 2, items_averaged = 1, data_type = "integer") |>
  dplyr::filter(!consistency) |>
  explain_map()

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