Learn R Programming

scrutiny (version 1.0.0)

explain_map: 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, ...)

Value

data with an explanation column, a string per row.

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.

Examples

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

Run the code above in your browser using DataLab