x_read_disk: Read an _agent_, _informant_, _multiagent_, or table scan...

View source: R/object_ops.R

x_read_diskR Documentation

Read an agent, informant, multiagent, or table scan from disk

Description

An agent, informant, multiagent, or table scan that has been written to disk (with x_write_disk()) can be read back into memory with the x_read_disk() function. For an agent or an informant object that has been generated in this way, it may not have a data table associated with it (depending on whether the keep_tbl option was TRUE or FALSE when writing to disk) but it should still be able to produce reporting (by printing the agent or informant to the console or using get_agent_report()/get_informant_report()). An agent will return an x-list with get_agent_x_list() and yield any available data extracts with get_data_extracts(). Furthermore, all of an agent's validation steps will still be present (along with results from the last interrogation).

Usage

x_read_disk(filename, path = NULL, quiet = FALSE)

Arguments

filename

The name of a file that was previously written by x_write_disk().

path

An optional path to the file (combined with filename).

quiet

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

Details

Should a written-to-disk agent or informant possess a table-prep formula or a specific in-memory tablewe could use the interrogate() or incorporate() function again. For a data quality reporting workflow, it is useful to interrogate() target tables that evolve over time. While the same validation steps will be used, more can be added before calling interrogate(). For an information management workflow with an informant object, using incorporate() will update aspects of the reporting such as table dimensions, and info snippets/text will be regenerated.

Value

Either a ptblank_agent, ptblank_informant, or a ptblank_tbl_scan object.

Examples

A: Reading an agent from disk

The process of developing an agent and writing it to disk with the x_write_disk() function is explained in that function's documentation. Suppose we have such a written file that's named "agent-small_table.rds", we could read that to a new agent object with x_read_disk().

agent <- x_read_disk("agent-small_table.rds")

B: Reading an informant from disk

If there is an informant written to disk via x_write_disk() and it's named "informant-small_table.rds". We could read that to a new informant object with x_read_disk().

informant <- x_read_disk("informant-small_table.rds")

C: Reading a multiagent from disk

The process of creating a multiagent and writing it to disk with the x_write_disk() function is shown in that function's documentation. Should we have such a written file called "multiagent-small_table.rds", we could read that to a new multiagent object with x_read_disk().

multiagent <- x_read_disk("multiagent-small_table.rds")

D: Reading a table scan from disk

If there is a table scan written to disk via x_write_disk() and it's named "tbl_scan-storms.rds", we could read it back into R with x_read_disk().

tbl_scan <- x_read_disk("tbl_scan-storms.rds")

Function ID

9-2

See Also

Other Object Ops: activate_steps(), deactivate_steps(), export_report(), remove_steps(), set_tbl(), x_write_disk()


pointblank documentation built on April 25, 2023, 5:06 p.m.