rmProjectOption-character-missing-method: Remove Project Option (char-miss)

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

Description

See generic: rmProjectOption

Usage

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

Arguments

id

character.

where

missing.

sub_id

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

strict

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

Author(s)

Janko Thyson janko.thyson@gmail.com

References

http://github.com/Rappster/optionr

See Also

rmProjectOption

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## Not run: 

##------------------------------------------------------------------------------
## Default `where` //
##------------------------------------------------------------------------------

container <- initializeOptionContainer(overwrite = TRUE)
setProjectOption(id = "a", value = TRUE)
rmProjectOption(id = "a")
exists("a", container$options, inherits = FALSE)

setProjectOption(id = "a/b/c", value = 10)
rmProjectOption(id = "a/b/c")
exists("c", container$options$a$b, inherits = FALSE)

##------------------------------------------------------------------------------
## Different `where` //
##------------------------------------------------------------------------------
  
where <- "test"
container <- initializeOptionContainer(id = where, overwrite = TRUE)
".test" %in% names(options())
setProjectOption(id = "a/b/c", value = 10, where = where)
rmProjectOption(id = "a/b/c", where = where)
exists("c", container$options$a$b, inherits = FALSE)
  
where <- structure(list(id = "test"), class = "OptionContext.Test")
container <- initializeOptionContainer(id = where, overwrite = TRUE)
".test" %in% names(options())
setProjectOption(id = "a/b/c", value = 10, where = where)
rmProjectOption(id = "a/b/c", where = where)
exists("c", container$options$a$b, inherits = FALSE)

##------------------------------------------------------------------------------
## Strictness //
##------------------------------------------------------------------------------
  
container <- initializeOptionContainer(overwrite = TRUE)
rmProjectOption(id = "a")
try(rmProjectOption(id = "a", strict = 2))

rmProjectOption(id = "a/b/c")
try(rmProjectOption(id = "a/b/c", strict = 2))

rmProjectOption(id = character())
try(rmProjectOption(id = character(), strict = 2))
    

## End(Not run)

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