R/discard.R
discard.Rd
Search and remove an element from an object. If the element is not found, ignore the attempt.
discard(.x, ...) ref_discard(.x, ...) # S3 method for class 'Container' discard(.x, ...) # S3 method for class 'Container' ref_discard(.x, ...)
any R object.
R
elements to be discarded.
For Container, an object of class Container (or one of the respective derived classes).
Container
s = setnew("a", num = 1:3, data = iris) print(s) #> {"a", num = (1L 2L 3L), data = <<data.frame(150x5)>>} discard(s, 1:3, "a") #> {data = <<data.frame(150x5)>>} discard(s, iris) #> {"a", num = (1L 2L 3L)} discard(s, "b") # ignored #> {"a", num = (1L 2L 3L), data = <<data.frame(150x5)>>}