easy_split | R Documentation |
Easily split a list into a list of equally sized vectors.
easy_split(x, size_of_each_group = NULL, number_of_groups = NULL)
x |
The vector to be split |
size_of_each_group |
If you want to split 'x' into a number of groups, each of 'size_of_each_group' size |
number_of_groups |
How many equally sized groups do you want? |
You can either specify the length of the list (via 'number_of_groups') or the length of the equally sized vectors within each list element (via 'size_of_each_group'). The last element of the list can be shorter than the other elements.
A list containing equally sized vectors.
easy_split(letters[1:20], size_of_each_group = 3)
easy_split(letters[1:20], number_of_groups = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.