add | R Documentation |
Add elements to container-like objects.
add(.x, ...)
ref_add(.x, ...)
## S3 method for class 'Container'
add(.x, ...)
## S3 method for class 'Container'
ref_add(.x, ...)
## S3 method for class 'Dict'
add(.x, ...)
## S3 method for class 'Dict'
ref_add(.x, ...)
## S3 method for class 'dict.table'
add(.x, ...)
## S3 method for class 'dict.table'
ref_add(.x, ...)
.x |
an |
... |
elements to be added. |
For Container, an object of class Container (or one of the respective derived classes).
For dict.table an object of class dict.table.
While add uses copy semantics ref_add works by reference.
If .x
is a Container, Set or Deque object, the elements being added
can (but must not) be named.
If .x
is a Dict or dict.table object,
all elements must be of the form key = value
.
If one of the keys already exists, an error is given.
co = container(1)
add(co, 1, b = 2, c = container(1:3))
s = setnew(1)
add(s, 1, 1, b = 2, "1", co = container(1, 1))
d = dict(a = 1)
add(d, b = 2, co = container(1:3))
try(add(d, a = 7:9)) # key 'a' already in Dict
dit = dict.table(a = 1:3)
add(dit, b = 3:1, d = 4:6)
try(add(dit, a = 7:9)) # column 'a' already exists
dit = dict.table(a = 1:3)
add(dit, b = 3:1, d = 4:6)
try(add(dit, a = 7:9)) # column 'a' already exists
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.