Suppose in R I have the following vector :
[1 2 3 10 20 30]
How do I perform an operation whereby at each index 3 consecutive elements are summed, resulting in the following vector :
[6 15 33 60]
where the first element = 1+2+3, the second element = 2+3+10 etc...? Thanks