popone-list-method: Remove and return an element from a list

Description Usage Arguments Value Author(s) Examples

Description

Remove and return an element from an R object, given name or index. Default: the last element Note: the R object is altered in place, like Python List pop()

Usage

1
2
## S4 method for signature 'list'
popone(obj, x, warn = TRUE, error = TRUE)

Arguments

obj

an R object

x

name or index

warn

logical, whether warn at error

error

logical, whether stop at error

Value

the element and the R object is altered in place

Author(s)

Xiaobei Zhao

Examples

1
2
3
4
5
ll <- list(1,2,3,a=4,b=5,6,7,c=8,9)
popone(ll,"a")
popone(ll,1) ## remove the 1st in ll
popone(ll,1) ## remove the next (2nd of the origin)
try(popone(list(),"a"))


Xmisc documentation built on May 19, 2017, 8:44 p.m.
Search within the Xmisc package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.