Hi, May be this helps: vec1<- 1:10 library(zoo) rollmean(vec1,2) #[1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 vec2<- c(5,8,9,13,20) diff(vec2) #[1] 3 1 4 7 A.K. Hello, How can I calculate half sum of 2 observ (l(i) + l(i+1))/2 ? How compute f(i) - f(i+1) ? please help me.