insert_named | R Documentation |
Insert elements from y
into x
by name, or remove elements from x
by name.
Works for vectors, lists, environments and data frames and data tables.
Objects with reference semantic (environment()
and data.table::data.table()
) might be modified in-place.
insert_named(x, y)
## S3 method for class ''NULL''
insert_named(x, y)
## Default S3 method:
insert_named(x, y)
## S3 method for class 'environment'
insert_named(x, y)
## S3 method for class 'data.frame'
insert_named(x, y)
## S3 method for class 'data.table'
insert_named(x, y)
remove_named(x, nn)
## S3 method for class 'environment'
remove_named(x, nn)
## S3 method for class 'data.frame'
remove_named(x, nn)
## S3 method for class 'data.table'
remove_named(x, nn)
x |
( |
y |
( |
nn |
( |
Modified object.
x = list(a = 1, b = 2)
insert_named(x, list(b = 3, c = 4))
remove_named(x, "b")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.