Description Usage Arguments Details Value Examples
This functions splits a vector into chunks of size k, and returns a list of vectors. The last vector in the list will be less than length k if k doesn't divide the length of the vector exactly.
1 | split_vector(vec, k)
|
vec |
The vector to split into chunks. |
k |
The size of each chunks. |
Parameter k must be of type numeric. If not an integer, it will be coerced to an integer using trunc().
Parameter vec must be a vector but can contain any element type.
A list of vectors, each vector of size k, except possibly the last one.
1 | split_vector(c(1,2,3,4,5), 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.