The DataPackageR YAML configuration file.

Greg Finak

2018-10-24

Configuring and controlling DataPackageR builds.

Data package builds are controlled using the datapackager.yml file.

This file is created in the package source tree when the user creates a package using datapackage_skeleton().

It is automatically populated with the names of the code_files and data_objects the passed in to datapackage_skeleton.

The datapackager.yml file.

The structure of a correctly formatted datapackager.yml file is shown below:

configuration:
  files:
    subsetCars.Rmd:
      enabled: yes
  objects: cars_over_20
  render_root:
    tmp: '568733'

YAML config file properties.

The main section of the file is the configuration: section.

It has three properties:

Editing the YAML config file.

The structure of the YAML is simple enough to understand but complex enough that it can be a pain to edit by hand.

DataPackageR provides a number of API calls to construct, read, modify, and write the yaml config file.

API calls

yml_find

Read a yaml config file from a package path into an r object.

yml_list_objects

List the objects in a config read by yml_find.

Example

cars_over_20

yml_list_files

List the files in a config read by yml_find.

Example

subsetCars.Rmd

yml_disable_compile

Disable compilation of named files in a config read by yml_find.

Example
configuration:
  files:
    subsetCars.Rmd:
      enabled: no
  objects: cars_over_20
  render_root:
    tmp: '684509'

yml_enable_compile

Enable compilation of named files in a config read by yml_find.

Example
configuration:
  files:
    subsetCars.Rmd:
      enabled: yes
  objects: cars_over_20
  render_root:
    tmp: '684509'

yml_add_files

Add named files to a config read by yml_find.

Example
configuration:
  files:
    subsetCars.Rmd:
      enabled: yes
    anotherFile.Rmd:
      enabled: yes
  objects: cars_over_20
  render_root:
    tmp: '684509'

yml_add_objects

Add named objects to a config read by yml_find.

Example
configuration:
  files:
    subsetCars.Rmd:
      enabled: yes
    anotherFile.Rmd:
      enabled: yes
  objects:
  - cars_over_20
  - another_object
  render_root:
    tmp: '684509'

yml_remove_files

Remove named files from a config read by yml_find.

Example
configuration:
  files:
    subsetCars.Rmd:
      enabled: yes
  objects:
  - cars_over_20
  - another_object
  render_root:
    tmp: '684509'

yml_remove_objects

Remove named objects from a config read by yml_find.

Example
configuration:
  files:
    subsetCars.Rmd:
      enabled: yes
  objects: cars_over_20
  render_root:
    tmp: '684509'

yml_write

Write a modified config to its package path.

Example

The yml_oneobj read by yml_find() carries an attribute that is the path to the package. The user doesn’t need to pass a path to yml_write if the config has been read by yml_find.