I have to split a vector into n chunks of equal size in R. I couldn\'t find any base function to do that. Also Google didn\'t get me anywhere. Here is what I came up with so
Yet another possibility is the splitIndices function from package parallel:
splitIndices
parallel
library(parallel) splitIndices(20, 3)
Gives:
[[1]] [1] 1 2 3 4 5 6 7 [[2]] [1] 8 9 10 11 12 13 [[3]] [1] 14 15 16 17 18 19 20