extract | R Documentation |
Given a list of identical objects, extract the same index of each object. This can be used to extract the same column from a list of matrices, the same index from a list of vectors or the same element from a list of lists. Multiple indeces can be provided.
extract(l, index = 1, simplify = T)
l |
list of elements with identical structure. |
index |
numeric or character to be applied to each element of list. Logicals can also be used, but will not work well with lists of lists. |
simplify |
should the output be simplified? |
list, vector or matrix of extracted objects
example <- list(data.frame(A = "first dataframe", B = "second argument"),
data.frame(A = "second dataframe", B = "second argument"))
#From each data.frame extract column A
extract(example,"A")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.