Skip to contents

Get a configuration to use for a run.

Usage

get_cfg(cfg = NULL, overrides = NULL, cfg_dir = NULL, cfg_name = NULL)

Arguments

cfg

A list of nested lists, with 'leaf' nodes specifying configuration values. Default: The template config returned by generate_cfg_template()

overrides

A list containing settings with which to override the defaults. See section Details for more information.

cfg_dir

A character string specifying the config directory, or NULL for the default. Default: An OS-specific path for user configuration files in the user's home directory.

cfg_name

A character string specifying the config file name, or NULL for the default. Default: 'config.yml'

Value

A list containing settings for a run, constructed from defaults which would be overridden if config and/or overrides are supplied. See section Details for more information.

Details

If cfg is supplied, this will be the returned config unless overrides is also supplied, in which case the values in overrides will be substituted within cfg. If both cfg and overrides are NULL then the returned config will be the saved user config. If cfg is NULL and overrides is supplied, the returned config will be the saved user config with the values in overrides in overrides substituted.

Examples

get_cfg()
#> Warning: cannot open file '/home/runner/.config/R-dimex/config.yml': No such file or directory
#> Error in file(file, "rt", encoding = fileEncoding): cannot open the connection
get_cfg(overrides = list(run = list(seed_val = 200)))
#> Warning: cannot open file '/home/runner/.config/R-dimex/config.yml': No such file or directory
#> Error in file(file, "rt", encoding = fileEncoding): cannot open the connection