Dear all, I would like to know what is the most time efficient way to calculate the following in a huge vector.
Let's say that I have the vector 1,2,3,4,5,6 and I want to return a vector of the same length which every cell containing the sum of the previous cells like this 1, 1+2, 1+2+3, 1+2+3+4, 1+2+3+4+5, 1+2+3+4+5+6 What do you think is the most effective way to do that (not having to do the previous sum). Of course I can do this with a for loop but I believe that might be a more efficient way in R. I would like to thank you in advance for your help Best Regards Alex ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.