Learn R Programming

Xmisc (version 0.2.1)

getone,list-method: Get an element by index or name from a list

Description

Get an element by index or name from a list

Usage

"getone"(obj, x, safe = TRUE, msg = TRUE)

Arguments

obj
list
x
index or name of an element
safe
whether allow to get an element by index, in case this element is after any named element
msg
whether print a message

Value

list

Examples

Run this code
ll <- list(11,22,33,a=44,b=55,66,77,c=88,99)
getone(ll,numeric())
getone(ll,"a")
getone(ll,"c")
getone(ll,1)
getone(ll,7)
getone(ll,7,safe=FALSE)

Run the code above in your browser using DataLab