R/splitvec.R

Defines functions splitvec

splitvec <- function(x, chuncs){
  n <- length(x)

  lapply(seq(from = 1, to = n, by = ceiling(n/chuncs)),
         function(i){ ind0 <- i:min(i + ceiling(n/chuncs) - 1, n)
         x[ind0]}
  )
}
steinarv/k1 documentation built on Oct. 19, 2017, 4:41 a.m.