Create a new options manager.
Set up a set of options with default values and retrieve a manager for it.
options_manager(..., .list, .allowed)
... |
Comma separated |
.list |
optional List of |
.allowed |
list of named functions that check an option (see 'checking options') |
A function
that can be used as a custom options manager. It takes as arguments
a comma separated list of option names (character
) to retrieve options or
[name]=[value]
pairs to set options.
The function options_manager
creates an option management function. The returned
function can be uset to set, get, or reset options. The only restriction of the package is
that the following words cannot be used as names for options:
.__reset
.__defaults
For more details and extensive examples see the vignette by copy-pasting this command:
vignette("settings", package = "settings")
Reset to default values: reset
.
Retrieve default values: defaults
Create a local, possibly altered copy: clone_and_merge
# create an options register my_options <- options_manager(foo=1,bar=2,baz='bob') ### Retrieving options my_options() # retrieve the full options list. my_options('baz') my_options('foo') # When multiple options are retrieved, the result is a list my_options('foo','baz') ### Setting global options my_options(foo=3,baz='pete') my_options() ### Reset options to default. reset(my_options) my_options() ### Limit the possible values for an option. my_options <- options_manager( fu="bar",.allowed = list(fu=inlist("foo","bar")) )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.