delete_at | R Documentation |
Search and remove values at given indices, which can be numeric or character or both. If any given index is invalid, an error is signaled. Indices can be numbers or names or both.
delete_at(.x, ...) ref_delete_at(.x, ...) ## S3 method for class 'Container' delete_at(.x, ...) ## S3 method for class 'Container' ref_delete_at(.x, ...) ## S3 method for class 'dict.table' delete_at(.x, ...) ## S3 method for class 'dict.table' ref_delete_at(.x, ...)
.x |
any |
... |
indices at which values are to be deleted. |
For Container
, an object of class Container
(or one of the
respective derived classes).
For dict.table
, an object of class dict.table
.
co = container(a = 1, b = 2, 3) delete_at(co, "a", "b") # [3] delete_at(co, 1:2) # [3] delete_at(co, "a", 3) # [b = 2] try({ delete_at(co, 4) # index out of range delete_at(co, "x") # names(s) not found: 'x' }) dit = as.dict.table(head(sleep)) dit delete_at(dit, "ID") delete_at(dit, "ID", 1) try({ delete_at(dit, "foo") # Column 'foo' not in dict.table })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.