discard_at {container} | R Documentation |
Discard Elements at Indices
Description
Search and remove values at given indices, which can be numeric or character or both. Invalid indices are ignored.
Usage
discard_at(.x, ...)
ref_discard_at(.x, ...)
## S3 method for class 'Container'
discard_at(.x, ...)
## S3 method for class 'Container'
ref_discard_at(.x, ...)
## S3 method for class 'dict.table'
discard_at(.x, ...)
## S3 method for class 'dict.table'
ref_discard_at(.x, ...)
Arguments
.x |
any |
... |
indices at which values are to be discarded. |
Value
For Container
, an object of class Container
(or one of the
respective derived classes).
For dict.table
, an object of class dict.table
.
Examples
co = container(a = 1, b = 2, 3)
discard_at(co, "a", "b") # [3]
discard_at(co, 1:2) # [3]
discard_at(co, "a", 3) # [b = 2]
discard_at(co, "x") # ignored
dit = as.dict.table(head(sleep))
discard_at(dit, "ID")
discard_at(dit, "ID", 1)
discard_at(dit, "foo") # ignored
[Package container version 1.0.4 Index]