get_agent_x_list {pointblank}R Documentation

Get the agent's x-list

Description

The agent's x-list is a record of information that the agent possesses at any given time. The x-list will contain the most complete information after an interrogation has taken place (before then, the data largely reflects the validation plan). The x-list can be constrained to a particular validation step (by supplying the step number to the i argument), or, we can get the information for all validation steps by leaving i unspecified. The x-list is indeed an R list object that contains a veritable cornucopia of information.

For an x-list obtained with i specified for a validation step, the following components are available:

If i is unspecified (i.e., not constrained to a specific validation step) then certain length-one components in the x-list will be expanded to the total number of validation steps (these are: i, type, columns, values, briefs, eval_error, eval_warning, capture_stack, n, n_passed, n_failed, f_passed, f_failed, warn, stop, and notify). The x-list will also have additional components when i is NULL, which are:

Usage

get_agent_x_list(agent, i = NULL)

Arguments

agent

The pointblank agent object

⁠obj:<ptblank_agent>⁠ // required

A pointblank agent object that is commonly created through the use of the create_agent() function.

i

A validation step number

⁠scalar<integer>⁠ // default: NULL (optional)

The validation step number, which is assigned to each validation step in the order of invocation. If NULL (the default), the x-list will provide information for all validation steps. If a valid step number is provided then x-list will have information pertaining only to that step.

Value

An x_list object.

Examples

Create a simple data frame with a column of numerical values.

tbl <- dplyr::tibble(a = c(5, 7, 8, 5))

tbl
#> # A tibble: 4 x 1
#>       a
#>   <dbl>
#> 1     5
#> 2     7
#> 3     8
#> 4     5

Create an action_levels() list with fractional values for the warn, stop, and notify states.

al <-
  action_levels(
    warn_at = 0.2,
    stop_at = 0.8,
    notify_at = 0.345
  )

Create an agent (giving it the tbl and the al objects), supply two validation step functions, then interrogate.

agent <-
  create_agent(
    tbl = tbl,
    actions = al
  ) %>%
  col_vals_gt(columns = a, value = 7) %>%
  col_is_numeric(columns = a) %>%
  interrogate()

Get the f_passed component of the agent x-list.

x <- get_agent_x_list(agent)

x$f_passed
#> [1] 0.25 1.00

Function ID

8-1

See Also

Other Post-interrogation: all_passed(), get_data_extracts(), get_sundered_data(), write_testthat_file()


[Package pointblank version 0.12.1 Index]