Create a local, altered copy of an options manager
Local options management.
clone_and_merge(options, ...)
options |
A function as returned by |
... |
Options to be merged, in the form of |
A option manager like options
, with possibly different settings.
This function creates a copy of the options manager options
, with the same defaults.
However, the current settings may be altered by passing extra arguments. Its intended use
is to allow for easy merging of local options with global settings in a function call.
Some more examples can be found in the vignette: vignette('settings',package='options')
.
# Create global option manager. opt <- options_manager(foo=1,bar='a') # create an altered copy loc_opt <- clone_and_merge(opt, foo=2) # this has no effect on the 'global' version opt() # but the local version is different loc_opt() # we alter the global version and reset the local version opt(foo=3) reset(loc_opt) opt() loc_opt() # create an options manager with some option values limited opt <- options_manager(prob=0.5,y='foo',z=1, .allowed=list( prob = inrange(min=0,max=1) , y = inlist("foo","bar") ) ) # change an option opt(prob=0.8) opt("prob") ## Not run: # this gives an error opt(prob=2) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.