Learn R Programming

pointblank (version 0.7.0)

x_write_disk: Write a pointblank agent or informant to disk

Description

Writing an agent or informant to disk with x_write_disk() can be useful for keeping data validation intel or table information close at hand for later retrieval (with x_read_disk()). By default, any data table that the agent or informant may have held before being committed to disk will be expunged. This behavior can be changed by setting keep_tbl to TRUE but this only works in the case where the table is not of the tbl_dbi or the tbl_spark class.

Usage

x_write_disk(
  x,
  filename,
  path = NULL,
  keep_tbl = FALSE,
  keep_extracts = FALSE,
  quiet = FALSE
)

Arguments

x

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

filename

The filename to create on disk for the agent or informant.

path

An optional path to which the file should be saved (this is automatically combined with filename).

keep_tbl

An option to keep a data table that is associated with the agent or informant (which is the case when the agent, for example, is created using create_agent(tbl = <data table, ...)). The default is FALSE where the data table is removed before writing to disk. For database tables of the class tbl_dbi and for Spark DataFrames (tbl_spark) the table is always removed (even if keep_tbl is set to TRUE).

keep_extracts

An option to keep any collected extract data for failing rows. By default, this is FALSE.

quiet

Should the function not inform when the file is written? By default this is FALSE.

Value

Invisibly returns TRUE if the file has been written.

Function ID

9-1

Details

It is recommended to set up a table-prep formula so that the agent and informant can access refreshed data after being read from disk through x_read_disk(). This can be done initially with the read_fn argument of create_agent()/create_informant() or, later, with set_read_fn(). Alternatively, we can reintroduce the agent or informant to a data table with the set_tbl() function.

See Also

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