extract: Extract the nth element from vectors in a list.

Description Usage Arguments

View source: R/utilities.R


extract() simply uses a for loop to extract the nth element from each vector in a list. However, it can also operate on a data frame. This is equivalent to taking the first element of each vector and making a those elements the first vector in a new list, and it continues on so until it reaches the last element.


extract(lst, num = min(lengths(lst)))



A list of vectors of equal length, a data frame, or a matrix. If the length of the smallest vector in lst is smaller than num then an error will be thrown (subscript out of bounds).


A number (preferably the length of the vectors) to create a sequence for extract() to extract the elements of lst. Default value is the length of the shortest vector in the list.

ggloop documentation built on May 19, 2017, 1:55 p.m.

Search within the ggloop package
Search all R packages, documentation and source code