search for: splitit

Displaying 1 result from an estimated 1 matches for "splitit".

Did you mean: splitkit
2012 Nov 09
2
Creating yyyymm regexp strings on the fly for aggregation.
Folks, This question is somewhat related to a previous posting of mine. I just can't seem to create a generic solution. Here is a function that I found searching around the internet: splitIt <- function(x, n) {split(x, sort(rank(x) %% n))} I use it like so: > splitIt(1:12, 2) $`0` [1] 1 2 3 4 5 6 $`1` [1] 7 8 9 10 11 12 Or > splitIt(1:12, 4) $`0` [1] 1 2 3 $`1` [1] 4 5 6 $`2` [1] 7 8 9 $`3` [1] 10 11 12 I am splitting 12 months into 6-month or quarterly chunks. I can...