How can I partition a vector?
        Posted  
        
            by Karsten W.
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Karsten W.
        
        
        
        Published on 2010-03-12T18:15:44Z
        Indexed on 
            2010/03/12
            18:17 UTC
        
        
        Read the original article
        Hit count: 504
        
How can I build a function
slice(x, n=2) 
which would return a list of vectors where each vector except maybe the last has size n, i.e.
slice(letters, 10)
would return
list(c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"),
     c("k", "l", "m", "n", "o", "p", "q", "r", "s", "t"),
     c("u", "v", "w", "x", "y", "z"))
?
© Stack Overflow or respective owner