You don't need to set allowed values or ranges for each and every option. Only those options that have an entry in the .allowed list will be checked.

Global versus local options

It is nice when the behaviour of a function that depends on global options can be altered at function call.
With the settings package you can create local options as follows. First, we create a global options
manager.

my_options <- options_manager(a=2,b=3)

The following function uses global settings by default, but a user can overwrite them by passing extra options
as [name]=[value] pairs.

Note: the reset function may also be used to reset options in local_opts within the definiton of f. This will not affect the global options.

Using the settings package as options manager for your package.

The easiest way is probably to create a file for example called options.R. Here's an example.

# Variable, global to package's namespace.
# This function is not exported to user space and does not need to be documented.
MYPKGOPTIONS <- options_manager(a=1, b=2)
# User function that gets exported:
#' Set or get options for my package
#'
#' @param ... Option names to retrieve option values or \code{[key]=[value]} pairs to set options.
#'
#' @section Supported options:
#' The following options are supported
#' \itemize{
#' \item{\code{a}}{(\code{numeric};1) The value of a }
#' \item{\code{b}}{(\code{numeric};2) The value of b }
#' }
#'
#' @export
pkg_options <- function(...){
# protect against the use of reserved words.
stop_if_reserved(...)
MYPKGOPTIONS(...)
}

Here, we've introduced a new function called stop_if_reserved That is because a few words are for the
options package's internal use, see the documentation of stop_if_reserved for the list. All
reserved words start with .__ (dot-underscore-underscore) so the chance that a user tries to use them
is probably small. However, it's always good to be on the safe side.

Notes

If you depend the package on options, then reset (and all other functions) are available immediately for the user (this is not recommended).

If you import the package you have to export reset explicitly if you want to expose it. This can
be done for example by

Note that a adding a function to an object is really adding a reference (since each function has its own
environment, which is a reference object). For every instance of TestClass where the options slot is the default, a call to @options is a call to the global opt.

Now, we define a user-facing function that can set or get options, eiter globally or specific to an
instance of TestClass.

There are two things to note here. First of all we've introduced the utility function is_setting which determines if the arguments in ... are meant to set options (TRUE) or to get them (FALSE).
Secondly, note that for the ANY method, we need to merge the value of the first argument.