knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
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")
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"
Gonfig is pretty much just a wrapper around config and glue. So check their documentation for advanced usage.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.