Read a pointblank YAML file to create an agent object
Read a pointblank YAML file to create an agent object
With yaml_read_agent() we can read a pointblank YAML file that describes a validation plan to be carried out by an agent (typically generated by the yaml_write() function. What's returned is a new agent
with that validation plan, ready to interrogate the target table at will (using the table-prep formula that is set with the tbl argument of create_agent()). The agent can be given more validation steps if needed before using interrogate() or taking part in any other agent ops (e.g., writing to disk with outputs intact via x_write_disk() or again to pointblank YAML with yaml_write()).
To get a picture of how yaml_read_agent() is interpreting the validation plan specified in the pointblank YAML, we can use the yaml_agent_show_exprs() function. That function shows us (in the console) the pointblank expressions for generating the described validation plan.
yaml_read_agent(filename, path =NULL)
Arguments
filename: File name
scalar<character> // required
The name of the YAML file that contains fields related to an agent.
path: File path
scalar<character> // default:NULL (optional)
An optional path to the YAML file (combined with filename).
Returns
A ptblank_agent object.
Examples
There's a YAML file available in the pointblank package that's also called "agent-small_table.yml". The path for it can be accessed through system.file():
This particular agent is using ~ tbl_source("small_table", "tbl_store.yml")
to source the table-prep from a YAML file that holds a table store (can be
seen using yaml_agent_string(agent = agent)). Let's put that file in the
working directory (the pointblank package has the corresponding YAML file):
As can be seen from the validation report, no interrogation was yet
performed. Saving an agent to YAML will remove any traces of interrogation
data and serve as a plan for a new interrogation on the same target table. We
can either follow this up with with interrogate() and get an agent with
intel, or, we can interrogate directly from the YAML file with
yaml_agent_interrogate():