rmNested-character-missing-method: Remove Nested (char-miss)

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

Description

See generic: rmNested

Usage

1
2
3
## S4 method for signature 'character,missing'
rmNested(id, where = parent.frame(),
  strict = c(0, 1, 2), ...)

Arguments

id

character.

where

missing.

strict

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

  • 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 rmNested-char-env-method

Author(s)

Janko Thyson [email protected]

References

http://github.com/Rappster/nestr

See Also

rmNested

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` //
##------------------------------------------------------------------------------

setNested(id = "a", value = TRUE)
exists("a", environment(), inherits = FALSE)
rmNested(id = "a")
exists("a", environment(), inherits = FALSE)

setNested(id = "a/b/c", value = 10, gap = TRUE)
exists("c", environment()$a$b, inherits = FALSE)
rmNested(id = "a/b/c")
exists("c", environment()$a$b, inherits = FALSE)

## Clean up //
rm(a)

##------------------------------------------------------------------------------
## Different `where` // 
##------------------------------------------------------------------------------

where <- new.env()
setNested(id = "a/b/c", value = 10, where = where, gap = TRUE)
rmNested(id = "a/b/c", where = where)
exists("c", where$a$b, inherits = FALSE)

## Clean up //
rm(where)
  
##------------------------------------------------------------------------------
## Strictness //
##------------------------------------------------------------------------------

rmNested(id = "a")
try(rmNested(id = "a", strict = 1))
try(rmNested(id = "a", strict = 2))

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

rmNested(id = character()))
try(rmNested(id = character(), strict = 1))
try(rmNested(id = character(), strict = 2))
    

## End(Not run)

rappster/nestr documentation built on May 24, 2017, 7:33 p.m.