getOptionContainer: Get Option Container (generic)

Description Usage Arguments Author(s) References See Also Examples

Description

Retrieves the environment that serves as an option container from the list of R options.

Usage

1
2
3
getOptionContainer(id = tryCatch(devtools::as.package(".")$package, error =
  function(cond) {     stop("Invalid default value for `id`") }),
  hidden = TRUE, ...)

Arguments

id

Signature argument. Object containing suitable information to control the actual retrieval process. In the simplest case, this corresponds to the name/ID of a package/package project. But it can also be an instance of a custom class for which a suitable methods are defined.

hidden

logical. TRUE: make sure name/ID information in id is preprended with a dot as the container was assigned with hidden = TRUE; FALSE: use name/ID information in id as is.

...

Further arguments to be passed to subsequent functions/methods.

Author(s)

Janko Thyson janko.thyson@gmail.com

References

http://github.com/Rappster/optionr

See Also

getOptionContainer-char-method, ensureOptionContainer, initializeOptionContainer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 

##------------------------------------------------------------------------------
## Default `id` //
##------------------------------------------------------------------------------

res <- ensureOptionContainer(overwrite = TRUE)
identical(getOptionContainer(), res)
options(".optionr" = NULL)
  
##------------------------------------------------------------------------------
## Hidden //
##------------------------------------------------------------------------------

res <- ensureOptionContainer(hidden = FALSE, overwrite = TRUE)
identical(getOptionContainer(hidden = FALSE), res)
options("optionr" = NULL)
  
##------------------------------------------------------------------------------
## As interface //
##------------------------------------------------------------------------------
  
id <- structure(list(id = "test"), class = "OptionContext.Test")
res <- ensureOptionContainer(id, hidden = FALSE, overwrite = TRUE)
identical(getOptionContainer(id, hidden = FALSE), res)
options("test" = NULL)
  

## End(Not run)

rappster/optionr documentation built on May 26, 2019, 11:23 p.m.