Multiple agents can be part of a single object called the multiagent.
This can be useful when gathering multiple agents that have performed
interrogations in the past (perhaps saved to disk with x_write_disk()
).
When be part of a multiagent, we can get a report that shows how data
quality evolved over time. This can be of interest when it's important to
monitor data quality and even the evolution of the validation plan itself.
The reporting table, generated by printing a ptblank_multiagent
object or
by using the get_multiagent_report()
function, is, by default, organized by
the interrogation time and it automatically recognizes which validation steps
are equivalent across interrogations.
Arguments
- ...
Pointblank agents
<series of obj:<ptblank_agent>>
// requiredOne or more pointblank agent objects.
- lang
Reporting language
scalar<character>
// default:NULL
(optional
)The language to use for any reporting that will be generated from the multiagent. (e.g., individual agent reports, multiagent reports, etc.). By default,
NULL
will create English ("en"
) text. Other options include French ("fr"
), German ("de"
), Italian ("it"
), Spanish ("es"
), Portuguese ("pt"
), Turkish ("tr"
), Chinese ("zh"
), Russian ("ru"
), Polish ("pl"
), Danish ("da"
), Swedish ("sv"
), and Dutch ("nl"
).- locale
Locale for value formatting within reports
scalar<character>
// default:NULL
(optional
)An optional locale ID to use for formatting values in the reporting outputs according the locale's rules. Examples include
"en_US"
for English (United States) and"fr_FR"
for French (France); more simply, this can be a language identifier without a country designation, like "es" for Spanish (Spain, same as"es_ES"
).
Examples
For the example below, we'll use two different, yet simple tables.
First, tbl_1
:
tbl_1 <-
dplyr::tibble(
a = c(5, 5, 5, 5, 5, 5),
b = c(1, 1, 1, 2, 2, 2),
c = c(1, 1, 1, 2, 3, 4),
d = LETTERS[a],
e = LETTERS[b],
f = LETTERS[c]
)
tbl_1
#> # A tibble: 6 x 6
#> a b c d e f
#> <dbl> <dbl> <dbl> <chr> <chr> <chr>
#> 1 5 1 1 E A A
#> 2 5 1 1 E A A
#> 3 5 1 1 E A A
#> 4 5 2 2 E B B
#> 5 5 2 3 E B C
#> 6 5 2 4 E B D
And next, tbl_2
:
tbl_2 <-
dplyr::tibble(
a = c(5, 7, 6, 5, 8, 7),
b = LETTERS[1:6]
)
tbl_2
#> # A tibble: 6 x 2
#> a b
#> <dbl> <chr>
#> 1 5 A
#> 2 7 B
#> 3 6 C
#> 4 5 D
#> 5 8 E
#> 6 7 F
Next, we'll create two different agents, each interrogating a different table.
First up, is agent_1
:
agent_1 <-
create_agent(
tbl = tbl_1,
tbl_name = "tbl_1",
label = "Example table 1."
) %>%
col_vals_gt(columns = a, value = 4) %>%
interrogate()
Then, agent_2
:
agent_2 <-
create_agent(
tbl = tbl_2,
tbl_name = "tbl_2",
label = "Example table 2."
) %>%
col_is_character(columns = b) %>%
interrogate()
Now, we'll combine the two agents into a multiagent with the
create_multiagent()
function. Printing the "ptblank_multiagent"
object
displays the multiagent report with its default options (i.e., a 'long'
report view).
multiagent <- create_multiagent(agent_1, agent_2)
multiagent
To take advantage of more display options, we could use the
get_multiagent_report()
function. The added functionality there allows for
a 'wide' view of the data (useful for monitoring validations of the same
table over repeated interrogations), the ability to modify the title of the
multiagent report, and a means to export the report to HTML (via
export_report()
).
See also
Other The multiagent:
get_multiagent_report()
,
read_disk_multiagent()