The goal of tgconfig is to provide infrastructure for managing package parameters, inspired by pgkconfig

Code

code can be found at https://github.com/tanaylab/tgconfig

Installation

install.packages('tgconfig', repos=c(getOption('repos'), 'https://tanaylab.github.io/repo'))

Usage

Parameters are easy to get in relevant functions within a package:

library(tgconfig)
register_param('param', 'scrdb')
set_param('param', 'value', 'scrdb')
get_param_strict('param', 'scrdb')
#> [1] "value"

Error is thrown if a parameter is missing:

Developers are able to register parameters and set their default value in a config file that is part of the package in YAML format:

Users are able to override parameters using their own YAML:

Users get an exception when trying to override a parameter that was not registered:

Users can load multiple parameters to the current environment: