I have a vector
v<-c(1,2,3)
I need add the numbers in the vector in the following fashion
1,1+2,1+2+3
prod
Use the cumulative sum function:
cumsum(v) #[1] 1 3 6