Skip to content
Prev 31074 / 398506 Next

sum

On Wednesday 23 April 2003 12:57 pm, Luis Silva wrote:
If the list is not too long, perhaps

sumlist <- 
    function(x) 
        if (length(x) > 2) sumlist(x[1:2]) + 
             sumlist(x[-(1:2)]) else do.call("+", x) 



sumlist(<whatever your list is>)


-Deepayan