getMetaValue-character-environment-method: Get Meta Value (char-env)

Description Usage Arguments Value Author(s) References See Also Examples

Description

See generic: getMetaValue

Usage

1
2
3
4
5
## S4 method for signature 'character,environment'
getMetaValue(id,
  where = tryCatch(devtools::as.package(".")$package, error = function(cond) {
      stop("Invalid default value for `where`") }), sub_id = character(),
  default = NULL, strict = c(0, 1, 2), ...)

Arguments

id

character.

where

environment.

sub_id

character. Optional ID for a sub layer. Useful for a hub-like option container structure.

default

ANY. Value to be returned if option does not exist. See getOption and getNested.

strict

logical. Controls what happens when id points to a non-existing meta object:

  • 0: ignore and return FALSE to signal that the assignment process was not successful or fail_value depending on the value of return_status

  • 1: ignore and with warning and return FALSE

  • 2: ignore and with error

...

Further arguments to be passed to subsequent functions/methods.

Value

See method getMetaValue-char-char-method

Author(s)

Janko Thyson janko.thyson@gmail.com

References

http://github.com/Rappster/optionr

See Also

getMetaValue

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
30
31
32
33
## Not run: 

##------------------------------------------------------------------------------
## Default location of option container //
##------------------------------------------------------------------------------

## NOTE
## Obmitting `where` (and `id` in `initializeOptionContainer()`) in the all 
## calls will assign the overall option container to the package/project 
## name (if `hidden = TRUE` it is additionally prepended by a `.`)

initializeOptionContainer(overwrite = TRUE)
setMetaValue(id = "x_1", value = 10)
getMetaValue(id = "x_1")

##------------------------------------------------------------------------------
## Explicit location of option container //
##------------------------------------------------------------------------------

initializeOptionContainer(id = "test", overwrite = TRUE)
setMetaValue(id = "x_1", value = 10, where = "test")
getMetaValue(id = "x_1", where = "test")

##------------------------------------------------------------------------------
## Sub ID //
##------------------------------------------------------------------------------

initializeOptionContainer(sub_id = "a", overwrite = TRUE)
setMetaValue(id = "x_1", value = 10, sub_id = "a")
getMetaValue(id = "x_1", sub_id = "a")


## End(Not run)

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