Description Usage Arguments Details Author(s) References See Also Examples
Copies essential information of a reactive object to a new object.
1 2 | copyReactive(id_from, where_from = parent.frame(), id_to,
where_to = parent.frame(), ...)
|
id_from |
Signature argument. Object containing name/ID information of object to copy. |
where_from |
Signature argument.
Object containing location information of object |
id_to |
Signature argument. Object containing name/ID information of object to assign the copy to. |
where_to |
Signature argument. Object containing location information of object that the copy is assigned to. |
... |
Further arguments to be passed to subsequent functions/methods. |
Takes the essential information of a reactive object (fields value
,
refs_pull
, refs_push
and funct
of the invisible instance
of class ReactiveObject.S3
and creates a new reactive
object of name id
in where
with that information.
The important thing to note is that the two objects (and their invisible objects)
are not connected via any environments (pass-by-reference) as would be the
case if the copy was carried out by a mere call to <-
.
Janko Thyson janko.thyson@rappster.de
http://github.com/Rappster/reactr
copyReactive-character-character-environment-environment-method
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 | ## Not run:
##------------------------------------------------------------------------------
## setReactive --> ReactiveObject.S3 //
##------------------------------------------------------------------------------
setReactive(id = "x_1", value = 10)
copyReactive(id_from = "x_1", id_to = "x_1_c")
x_1_c == x_1
x_1 <- 20
x_1_c
## --> x_1_c is not affected by the change in `x_1` as the two underlying
## invisible objects are independent from each other:
identical(getFromRegistry("x_1"), getFromRegistry("x_1_c"))
## Classes //
class(getFromRegistry("x_1"))
class(getFromRegistry("x_1_c"))
##------------------------------------------------------------------------------
## setShinyReactive --> ReactiveShinyObject //
##------------------------------------------------------------------------------
setShinyReactive(id = "x_1", value = 10)
copyReactive(id_from = "x_1", id_to = "x_1_c")
x_1_c == x_1
x_1 <- 20
x_1_c
## --> x_1_c is not affected by the change in `x_1` as the two underlying
## invisible objects are independent from each other:
identical(getFromRegistry("x_1"), getFromRegistry("x_1_c"))
## Classes //
class(getFromRegistry("x_1"))
class(getFromRegistry("x_1_c"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.