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.
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: '486574'
The main section of the file is the configuration:
section.
It has three properties:
files:The files (R or Rmd) to be processed by
DataPackageR. They are processed in the order shown. Users running
multi-script workflows with dependencies between the scripts need to
ensure the files are processed in the correct order. Here
subsetCars.Rmd is the only file to process. The name is
transformed to an absolute path within the package.
Each file itself has just one property:
enabled:A logical yes, no flag indicating whether
the file should be rendered during the build, or whether it should be
skipped.
This is useful for ‘turning off’ long running processing tasks if they have not changed. Disabling processing of a file will not overwrite existing documentation or data objecs created during previous builds.
objects:The names of the data objects created by the processing files, to be stored in the package. These names are compared against the objects created in the render environment by each file. The names must match.
render_root:The directory where the Rmd or R files will
be rendered which will default to a randomly named subdirectory given by
tempdir(). This render location will allow workflows that
use multiple scripts, and will create file system artifacts to function
correctly by simply writing to and reading from the working
directory.
The structure of the YAML is simple enough to understand but complex enough that it can be challenging to edit manually.
DataPackageR provides a number of API calls to construct, read, modify, and write the yaml config file.
construct_yml_configMake an r object representing a YAML config file.
yml_findRead a yaml config file from a package path into an r object.
yml_list_objectsList the objects in a config read by
yml_find.
yml_list_filesList the files in a config read by
yml_find.
yml_disable_compileDisable compilation of named files in a config read by
yml_find.
yml_enable_compileEnable compilation of named files in a config read by
yml_find.
yml_add_filesAdd named files to a config read by yml_find.
yml_add_objectsAdd named objects to a config read by yml_find.
yml_remove_filesRemove named files from a config read by yml_find.
yml_remove_objectsRemove named objects from a config read by yml_find.