setRegistryValue-character-ANY-character-method: setRegistryValue (char-any-char)

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

Description

See generic: setRegistryValue

Usage

1
2
3
4
5
6
7
## S4 method for signature 'character,ANY,character'
setRegistryValue(id, value,
  where = tryCatch(devtools::as.package(".")$package, error = function(cond) {
      stop("Invalid default value for `where`") }), sub_id = character(),
  fail_value = NULL, force = FALSE, gap = TRUE, must_exist = FALSE,
  reactive = FALSE, return_status = TRUE, strict = c(0, 1, 2),
  typed = FALSE, ...)

Arguments

id

character.

value

ANY.

where

character.

sub_id

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

fail_value

ANY. Value that is returned if assignment failed and return_status = FALSE.

force

logical. TRUE: when dirname(id) points to a leaf instead of a branch (i.e. dirname(id) is not an environment), overwrite it to turn it into a branch and vice versa when id points to a branch that is to be transformed into a leaf; FALSE: either return with fail_value or signal condition depending on value of strict.

gap

logical. TRUE: when dirname(id) points to a non-existing parent branch or if there are any missing branches in the nested structure, then auto-create all missing branches; FALSE: either return with fail_value or throw a condition in such cases (depending on strict);

must_exist

logical. TRUE: id pointing to a non-existing registry object either results in return value fail_value or signal a condition depending on strict; FALSE: registry object that id points to is set.

reactive

logical. TRUE: set reactive registry object via setShinyReactive. FALSE: set regular/non-reactive registry object value. Note that if value inherits from ReactiveExpression (which it does if reactiveExpression or wrappers around this function are used), reactive is automatically set to TRUE.

return_status

logical. TRUE: return status (TRUE for successful assignment, FALSE for failed assignment); FALSE: return actual assignment value (value) or fail_value.

strict

logical. Controls what happens when id points to a non-existing registry 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

typed

logical. TRUE: create an implicitly typed registry object; FALSE: create a regular registry object.

Value

logical. TRUE.

Author(s)

Janko Thyson janko.thyson@gmail.com

References

http://github.com/Rappster/optionr

See Also

setRegistryValue

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)
setRegistryValue(id = "x_1", value = 10)
getRegistryValue(id = "x_1")

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

initializeOptionContainer(id = "test", overwrite = TRUE)
setRegistryValue(id = "x_1", value = 10, where = "test")
getRegistryValue(id = "x_1", where = "test")

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

initializeOptionContainer(sub_id = "a", overwrite = TRUE)
setRegistryValue(id = "x_1", value = 10, sub_id = "a")
getRegistryValue(id = "x_1", sub_id = "a")


## End(Not run)

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