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
Credit to @Sebastian for this function
chunk <- function(x,y){ split(x, factor(sort(rank(row.names(x))%%y))) }