Description Usage Arguments Details Author(s) Examples
View source: R/setGlobalOptions.R
Produce a function which can get or set global options
1 |
... |
specification of options, see 'details' section |
The function has a short name set_opt
.
The most simple way is to construct an option function (e.g. opt()
) as:
1 2 3 4 | opt = set_opt(
"a" = 1,
"b" = "text"
)
|
Then users can get or set the options by
1 2 3 4 5 6 7 8 9 10 |
Options can be reset to their default values by:
1 | opt(RESET = TRUE)
|
The value for each option can be set as a list which contains more configurations of the option:
1 2 3 4 5 6 |
The different fields in the list can be used to filter or validate the option values.
.value
The default value.
.length
The valid length of the option value. It can be a vector, the check will be passed if one of the length fits.
.class
The valid class of the option value. It can be a vector, the check will be passed if one of the classes fits.
.validate
Validation function. The input parameter is the option value and should return a single logical value.
.failed_msg
Once validation failed, the error message that is printed.
.filter
Filtering function. The input parameter is the option value and it should return a filtered option value.
.read.only
Logical. The option value can not be modified if it is set to TRUE
.
.visible
Logical. Whether the option is visible to users.
.private
Logical. The option value can only be modified in the same namespace where the option function is created.
.synonymous
a single option name which should have been already defined ahead of current option. The option specified will be shared by current option.
.description
a short text for describing the option. The description is only used when printing the object.
For more detailed explanation, please go to the vignette.
Zuguang Gu <z.gu@dkfz.de>
1 2 3 4 5 6 | opt = set_opt(
a = 1,
b = "text"
)
opt
# for more examples, please go to the vignette
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.