yaml_informant_incorporate: Get an _informant_ from *pointblank* YAML and 'incorporate()'

View source: R/yaml_read_informant.R

yaml_informant_incorporateR Documentation

Get an informant from pointblank YAML and incorporate()

Description

The yaml_informant_incorporate() function operates much like the yaml_read_informant() function (reading a pointblank YAML file and generating an informant with all information in place). The key difference is that this function takes things a step further and incorporates aspects from the the target table (defined by table-prep formula that is required in the YAML file). The additional auto-invocation of incorporate() uses the default options of that function. As with yaml_read_informant() the informant is returned except, this time, it has been updated with the latest information from the target table.

Usage

yaml_informant_incorporate(filename, path = NULL)

Arguments

filename

The name of the YAML file that contains fields related to an informant.

path

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

Value

A ptblank_informant object.

Examples

There's a YAML file available in the pointblank package that's called "informant-small_table.yml". The path for it can be accessed through system.file():

yml_file_path <- 
  system.file(
    "yaml", "informant-small_table.yml",
    package = "pointblank"
  )

The YAML file can be read as an informant by using the yaml_informant_incorporate() function. If you expect metadata to change with time, it's best to use yaml_informant_incorporate() instead of yaml_read_informant() since the former will go the extra mile and perform incorporate() in addition to the reading.

informant <- yaml_informant_incorporate(filename = yml_file_path)

informant
This image was generated from the third code example in the `yaml_write()` help file.

As can be seen from the information report, the available table metadata was restored and reported. If the metadata were to change with time, that would be updated as well.

Function ID

11-7

See Also

Other pointblank YAML: yaml_agent_interrogate(), yaml_agent_show_exprs(), yaml_agent_string(), yaml_exec(), yaml_read_agent(), yaml_read_informant(), yaml_write()


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