Learn R Programming

pointblank (version 0.7.0)

remove_read_fn: Remove a table-prep formula associated with an agent or informant

Description

Removing an agent or an informant's association to a table-pre formula can be done with remove_read_fn(). This may be good idea in an interactive session when needing to rely on the direct association of a 'fixed' data table (settable in create_agent() and create_informant()'s tbl argument or with set_tbl()) instead of using a table-prep formula that might produce different a different table than expected. The table-prep formula can always be set again with set_read_fn().

Usage

remove_read_fn(x)

Arguments

x

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

Function ID

9-6

See Also

Other Object Ops: activate_steps(), deactivate_steps(), remove_steps(), remove_tbl(), set_read_fn(), set_tbl(), x_read_disk(), x_write_disk()

Examples

Run this code
# NOT RUN {
# Set proportional failure thresholds
# to the `warn`, `stop`, and `notify`
# states using `action_levels()`
al <- 
  action_levels(
      warn_at = 0.10,
      stop_at = 0.25,
    notify_at = 0.35
  )

# Create an agent that directly ingests
# the `small_table` object and also has
# a table-prep formula (when both are
# present the latter always obtains the
# table); apply the actions, add some
# validation steps and then interrogate
# the data that was read in
agent_1 <- 
  create_agent(
    tbl = small_table,
    read_fn = ~ small_table,
    tbl_name = "small_table",
    label = "An example.",
    actions = al
  ) %>%
  col_exists(vars(date, date_time)) %>%
  col_vals_regex(
    vars(b), "[0-9]-[a-z]{3}-[0-9]{3}"
  ) %>%
  rows_distinct() %>%
  interrogate()
  
# In a situation where `small_table`
# changes frequently and it's desirable
# to have a snapshot of the table, we
# can remove the table-prep formula so
# that the ingested `small_table` will
# be used
agent_2 <-
  agent_1 %>%
  remove_read_fn() %>%
  interrogate()
  
# }

Run the code above in your browser using DataLab