copyReactive: Copy Reactive Object (generic)

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

Description

Copies essential information of a reactive object to a new object.

Usage

1
2
copyReactive(id_from, where_from = parent.frame(), id_to,
  where_to = parent.frame(), ...)

Arguments

id_from

Signature argument. Object containing name/ID information of object to copy.

where_from

Signature argument. Object containing location information of object id_from.

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.

Details

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 <-.

Author(s)

Janko Thyson janko.thyson@rappster.de

References

http://github.com/Rappster/reactr

See Also

copyReactive-character-character-environment-environment-method

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
## 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)

rappster/reactr documentation built on May 26, 2019, 11:56 p.m.