| Config | R Documentation |
R6 Class representing a configuration object
R6 Class representing a configuration object
The special sublist directories is structured to contain three items for each
directory name:
versioned: a T/F value specifying whether the directory is versioned
path: the full path to the top level of that directory.
files: A named list referencing file paths within that directory.
If the directory is versioned, a version must be set in the versions sublist of the
config list. versions is itself a named list where each key corresponds to a
versioned folder in directories and the value gives the particular folder version
(for example, a timestamp) that corresponds to the particular run.
config_listThe list representation of the Config object
new()Create a new Config object
Config$new(config_list, versions = NULL)
config_listeither a list or a filepath to a YAML file containing that list
versions(default NULL) A named list containing versions for versioned
directories. If passed, used to define or update items in config_list$versions.
print()Print the list representation of the Config object
Config$print()
get()Get a subset of the config_list
Config$get(...)
...Nested indices (character or numeric) down the config list
If no parameters are passed, returns the entire config_list
A subset of the list. If the item is NULL or missing, returns an error
get_dir_path()Construct a directory path from the config object
Config$get_dir_path( dir_name, custom_version = NULL, fail_if_does_not_exist = FALSE )
dir_nameDirectory name
custom_version(character, default NULL) A custom version that will be
applied to this folder, rather than pulling from config_list$versions[[dir]].
Only applies to versioned folders.
fail_if_does_not_exist(logical, default FALSE) should this method return an error if the directory in question does not already exist?
Works differently for versioned and non-versioned directories. See the class description for more information.
The full path to the directory
get_file_path()Construct a file path from the config object
Config$get_file_path( dir_name, file_name, custom_version = NULL, fail_if_does_not_exist = FALSE )
dir_nameDirectory name
file_nameFile name within that directory
custom_version(character, default NULL) A custom version that will be
applied to this folder, rather than pulling from config_list$versions[[dir]].
Only applies to versioned folders.
fail_if_does_not_exist(logical, default FALSE) should this method return an error if the directory in question does not already exist?
Looks for the file path under:
config_list$directories[[dir_name]]$files[[file_name]]
The full path to the file Read a file based on the config
read()Config$read(dir_name, file_name, ..., custom_version = NULL)
dir_nameDirectory name
file_nameFile name within that directory
...Optional file reading arguments to pass to autoread()
custom_version(character, default NULL) A custom version that will be
applied to this folder, rather than pulling from config_list$versions[[dir]].
Only applies to versioned folders. If passed, this argument must always be
explicitly named.
The object loaded by autoread()
Write an object to file based on the config
write()Config$write(x, dir_name, file_name, ..., custom_version = NULL)
xObject to write
dir_nameDirectory name
file_nameFile name within that directory
...Optional file writing arguments to pass to autowrite()
custom_version(character, default NULL) A custom version that will be
applied to this folder, rather than pulling from config_list$versions[[dir]].
Only applies to versioned folders. If passed, this argument must always be
explicitly named.
Invisibly passes TRUE if successful Convenience function: write the config list to a folder as 'config.yaml'
write_self()Config$write_self(dir_name, ..., custom_version = NULL)
dir_nameDirectory name
...Optional file writing arguments to pass to autowrite()
custom_version(character, default NULL) A custom version that will be
applied to this folder, rather than pulling from config_list$versions[[dir]].
Only applies to versioned folders. If passed, this argument must always be
explicitly named.
Invisibly passes TRUE if successful
clone()The objects of this class are cloneable with this method.
Config$clone(deep = FALSE)
deepWhether to make a deep clone.
pull_from_list()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.