Skip to contents

Setting a data table to an agent or an informant with set_tbl() replaces any associated table (a data frame, a tibble, objects of class tbl_dbi or tbl_spark).


set_tbl(x, tbl, tbl_name = NULL, label = NULL)



A pointblank agent or informant object

obj:<ptblank_agent|ptblank_informant> // required

An agent object of class ptblank_agent, or, an informant of class ptblank_informant.


Table or expression for reading in one

obj:<tbl_*>|<tbl reading expression> // required

The input table for the agent or the informant. This can be a data frame, a tibble, a tbl_dbi object, or a tbl_spark object. Alternatively, an expression can be supplied to serve as instructions on how to retrieve the target table at interrogation- or incorporation-time. There are two ways to specify an association to a target table: (1) as a table-prep formula, which is a right-hand side (RHS) formula expression (e.g., ~ { <tbl reading code>}), or (2) as a function (e.g., function() { <tbl reading code>}).


A table name

scalar<character> // default: NULL (optional)

A optional name to assign to the new input table object. If no value is provided, a name will be generated based on whatever information is available.


An optional label for reporting

scalar<character> // default: NULL (optional)

An optional label for the validation plan or information report. If no value is provided then any existing label will be retained.


Set proportional failure thresholds to the warn, stop, and notify states using action_levels().

al <- 
      warn_at = 0.10,
      stop_at = 0.25,
    notify_at = 0.35

Create an agent that has small_table set as the target table via tbl. Apply the actions, add some validation steps and then interrogate the data.

agent_1 <- 
    tbl = small_table,
    tbl_name = "small_table",
    label = "An example.",
    actions = al
  ) %>%
  col_exists(columns = c(date, date_time)) %>%
    columns = b,
    regex = "[0-9]-[a-z]{3}-[0-9]{3}"
  ) %>%
  rows_distinct() %>%

Replace the agent's association to small_table with a mutated version of it (one that removes duplicate rows). Then, interrogate the new target table.

agent_2 <-
  agent_1 %>%
    tbl = small_table %>% dplyr::distinct()
  ) %>%

Function ID