1

I know how to diff( , lag=1, differences=1) can be used to find the spacing in every two consecutive rows, i.e. r2-r1,r3-r2,etc

But I am wondering how to find the spacings(difference) between sums of consecutive pairs and triplets in R. In other words, for consecutive triplets, spacing1 = (r4+r5+r6) - (r1+r2+r3), and so on.

Thanks

0 Answers0