lget | R Documentation |
lget
or lgetElement
applies
getElement
to a
list using lapply
. sget
and
sgetElement
do the same thing with
sapply
.
lget(X, name)
lgetElement(X, name)
sget(X, name, simplify = TRUE, USE.NAMES = TRUE)
sgetElement(X, name, simplify = TRUE, USE.NAMES = TRUE)
X |
A list. |
name |
a literal character string or a name (possibly backtick
quoted). For extraction, this is normally (see under
‘Environments’) partially matched to the |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
USE.NAMES |
logical; if |
A list (lget
) or vector (sget
)
of the same length as X
with the
name
parts of each element of X
.
e1 <- list(
x = rnorm(5),
y = letters[c(1:2, 2:1, 3)],
z = c(TRUE, TRUE, FALSE, TRUE, TRUE)
)
e2 <- list(
x = rnorm(5),
y = letters[c(1:4, 1)],
z = c(FALSE, TRUE, FALSE, TRUE, FALSE)
)
X <- list(e1, e2)
lget(X, name = "x")
sget(X, name = "y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.