| update | R Documentation |
Takes an object and updates it with values from another object by replacing the values at existing names and adding values at new names of the other object. A common use case is to update parameter lists.
ref_update(object, other, ...)
## S3 method for class 'Container'
update(object, other, ...)
## S3 method for class 'Container'
ref_update(object, other, ...)
## S3 method for class 'dict.table'
update(object, other, ...)
## S3 method for class 'dict.table'
ref_update(object, other, ...)
## S3 method for class 'list'
update(object, other, ...)
object |
any |
other |
any object of the same type as |
... |
additional arguments to be passed to or from methods. |
update uses copy semantics while ref_update works by reference,
that is, updates in place.
For Container, an object of class Container (or one of the
respective derived classes).
For dict.table an object of class dict.table.
For list, an updated object of class list.
d1 = dict(a = 1, b = 2)
d2 = dict( b = 0, c = 3)
update(d1, d2) # {a = 1, b = 0, c = 3}
update(d2, d1) # {a = 1, b = 2, c = 3}
dit1 = dict.table(a = 1:2, b = 3:4)
dit2 = dict.table( b = 5:6, c = 8:9)
update(d1, d2)
update(d2, d1)
l1 = list(1, b = 2)
l2 = list( b = 0, c = 3)
update(l1, l2)
update(l2, l1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.