Configuration

There are two types of configuration:

Both types are stored in the config object accessible from the global environment. The function project.config() will display the current configuration, including project specific configuration.

ProjectTemplate configuration

The current ProjectTemplate configuration settings exist in the config/global.dcf file:

You can override the values in global.dcf when loading the project by providing the option with the new setting:

> load.project(cache_loading = FALSE) # load the project without loading from the cache
> reload.project(cache_loading = FALSE, # Don't load from cache
                 data_ignore = '*.tsv') # Don't load tsv files

For backward compatibility it is still possible to provide a list of options, both as an unnamed argument or named override.config:

> load.project(list(cache_loading = FALSE)) # load the project without loading from the cache
> reload.project(override.config = list(cache_loading = FALSE, # Don't load from cache
                                        data_ignore = '*.tsv')) # Don't load tsv files

Note that this behavior might be removed in a future version of ProjectTemplate.

Project specific configuration

The project specific configuration is specified in the lib/globals.R file using the add.config function. This will contain whatever is relevant for your project, and will look something like this:

> add.config(
    keep_data = FALSE,                # should temporary data be kept?
    header = "Private & Confidential" # header in reports
  )

Note that commas need to be present after each config item except the last. Comments can also be inserted to document what each config variable does. To use project specific configuaration in any lib, munge or src script, simply use the form config$keep_data. ProjectTemplate will automatically load project specific content in lib/globals.R before any other file in lib, so the filename should not be changed. The add.config() function can also be used anywhere in the project. So if a particular analysis in src wanted to override the value in globals.R, you can simply add the relevant add.config() command to the top of that script.

Another option to override the setting is to pass it to load.project() as with normal options:

> load.project(keep_data = TRUE)

This only works for calls to add.config with the parameter apply.override set to TRUE, for the moment this parameter defaults to FALSE. The globals.R file in the standard full template therefore includes two calls to add.config with an explanation which section could be overridden.

###Additional parameters

Running the command below will run files from munge/experiment1 and write logs to logs/experiment1/project.log

> load.project(munge_sub_dir="experiment1", logs_sub_dir="experiment1")