create_multiagent {pointblank} | R Documentation |
Create a pointblank multiagent object
Description
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.
Usage
create_multiagent(..., lang = NULL, locale = NULL)
Arguments
... |
Pointblank agents
One or more pointblank agent objects. |
lang |
Reporting language
The language to use for any reporting that will be generated from the
multiagent. (e.g., individual agent reports, multiagent reports,
etc.). By default, |
locale |
Locale for value formatting within reports
An optional locale ID to use for formatting values in the reporting outputs
according the locale's rules. Examples include |
Value
A ptblank_multiagent
object.
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()
).
Function ID
10-1
See Also
Other The multiagent:
get_multiagent_report()
,
read_disk_multiagent()