update.ref: Update the value in ref object

Description Usage Arguments Examples

Description

Update the value in ref object. The constraint (if any) will be validated before any update of the ref object.

Usage

1
2
## S3 method for class 'ref'
update(object, value, ...)

Arguments

object

a ref object

value

the new value

...

additional parameters currently ignored.

Examples

1
2
3
4
5
6
7
8
ref1 <- ref(1:10)
update(ref1, rnorm(10))

ref2 <- ref(1:10, function(x) length(x) == 10L)
update(ref2, rnorm(10))
# The following will fail due to the violation
# of the constraint.
# update(ref2, rnorm(20))

renkun-ken/reflite documentation built on May 27, 2019, 5:50 a.m.