README.md

Build Status

R Config + Glue

The gonfig package makes it easy to manage project-wide configuration.

You can install the gonfig package from github as follow:

library(devtools)
devtools::install_github("supermayo/gonfig")

Usage

The usage is the same as config except that it allows glue litterals.

For instance your config file could be:

config.yml

default:
  year: 2000
  datafolder: "data"
  clean:
    input: "{datafolder}/data_{year}.csv"
    output: "{datafolder}/clean_{year}.csv"
  predict:
    input: "{clean$output}"
    output: "{datafolder}/forecast_{year+1}.csv"

Then you can load the configuratin as a list in R:

config <- config::get()
config$clean$output
#> "data/data_2000.csv"
config$predict$input
#> "data/forecast_2001.csv"

You can load a sub-element from the configuration as follows:

config <- config::get("predict")
config$input
#> "data/clean_2000.csv"

See Also

Gonfig is pretty much just a wrapper around config and glue. So check their documentation for advanced usage.

To Do



SuperMayo/gonfig documentation built on May 15, 2020, 11:34 a.m.