vpartition | R Documentation |
Split a vector to subvectors of specified lengths.
vpartition(x, lengths, matrixify = TRUE)
x |
vector to be splitted. |
lengths |
numeric vector. Lengths of the subvectors. |
matrixify |
logical. Whether to return matrix if lengths are identical. |
If sum(lengths)>length(x)
holds true, the extra places are filled with NA
s.
List of numeric vectors, or a matrix if all lengths are equal.
Tomas Bacigal
vpartition(1:10,c(4,5,2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.