Description Usage Arguments Implications with respect to observing variables Note Author(s) References See Also Examples
Removes the reactive character from an object, i.e. its
binding(s) to other objects and the ability for other objects to have
bindings to it. It is equivalent to transforming the object to one that
has been assigned via assign
or <-
instead of setReactive
and thus in turn
by makeActiveBinding
.
Note that it is not equivalent to removing/deleting the object!
See rmReactive
for this purpose.
1 | unsetReactive(id, where = parent.frame(), ...)
|
id |
Signature argument. Object containing path-like ID information. |
where |
Signature argument. Object containing location information. |
... |
Further arguments to be passed to subsequent functions/methods. |
If other reactive variables have been observing the reactive variable that has been unset, from this point on they will simply return the last value that has been cached. So there is no actual reactive binding anymore.
The main S4 method is
unsetReactive-character-environment-method
.
Janko Thyson janko.thyson@rappster.de
http://github.com/Rappster/reactr
unsetReactive-character-environment-method,
unsetReactiveByUid
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | ## Not run:
##------------------------------------------------------------------------------
## Non-strict get behavior //
##------------------------------------------------------------------------------
## Set example reactive objects //
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}")
## Unset //
## --> transforms objects into non-reactive/regular objects again
isReactive("x_1")
unsetReactive("x_1")
isReactive("x_1")
## Inspect //
x_1
identical(x_2, x_1)
x_1 <- 20
x_1
x_2
## --> no reactive relationship to 'x_1' anymore; last cached value returned
isReactive("x_2")
## Reset referenced object again //
setReactive(id = "x_1", value = 50)
x_1
identical(x_2, x_1)
## --> reactive relationship re-established again
## Clean up //
rmReactive("x_1")
rmReactive("x_2")
##------------------------------------------------------------------------------
## Strict get behavior level 1 //
##------------------------------------------------------------------------------
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}",
strict_get = 1)
unsetReactive("x_1")
try(x_2)
## --> warning and NULL
setReactive(id = "x_1", value = 50)
x_2
## --> reactive relationship restored
## Clean up //
rmReactive("x_1")
rmReactive("x_2")
##------------------------------------------------------------------------------
## Strict get behavior level 2 //
##------------------------------------------------------------------------------
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}",
strict_get = 2)
unsetReactive("x_1")
try(x_2)
## --> error
setReactive(id = "x_1", value = 50)
x_2
## --> reactive relationship restored
## Clean up //
rmReactive("x_1")
rmReactive("x_2")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.