The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

p a r a m s

sahilseth.github.io/params

Rationale

Setting/loading and extracting various options from/into the R environment

A package level alternative for options and getOptions, to prevent cluttering the space.

Main Features

Main functions

Examples:

Setting up some options

library(params)
set_opts(
    name = "John",
    verbose = TRUE, 
    my_dir = "~/mypath")
get_opts()  

Retrieving all options using get_opts()

name            value        
--------------  -------------
default_regex   (.*)         
my_conf_path    ~/flowr/conf 
my_dir          ~/mypath     
my_path         ~/flowr      
my_tool_exe     /usr/bin/ls  
name            John        
verbose         TRUE  

Retrieving a specific option

get_opts("my_dir")

Loading several options from a conf file

conf = system.file("conf/params.conf", package = "params")
load_opts(conf)

Nested options, re-use options as part of other options

set_opts(first = "John", last = "Doe",
    full = "{{{first}}} {{{last}}}")
get_opts('full')
"John Doe"

Using params in your own package

Params creates a environment object and stores all parameters in that object. Thus multiple packages using params packages may be loaded each with a separate set of options.

Setup: One liner to to be included in a package !

myopts = new_opts()

The above object provides three functions to load, set and fetch params:

Installation

## stable version from CRAN
install.packages("params") 

## latest, development version
devtools::install_github("sahilseth/params")

Updates

This package is under active-development, you may watch for changes using the watch link above.

Here is a example conf file::

## ----------------------- p a r a m s     config ------------------------ ##
## the file by default, sits in the R pacakge
## --------------------------------------------------------------------- ##

## Following lines, as a tab delimited table, with two columns
## Always use load_conf(); after editing this file !

## options ending with path, exe or dir are checked for existence. file.exists
my_path ~/flowr
my_tool_exe /usr/bin/ls
my_dir  path/to/a/folder


## you can define nested options
## these are parsed line by line

my_conf_path    {{{my_path}}}/conf

## --- all options are parsed as chracter
default_regex   (.*)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.