How can I rollapply or slide in a data frame in R with sliding width as well?

I have data frame in R that looks like this : a b 8 -16 19 -26 30 -36 41 -46 52 -56 I want to slide it or rollapply it with width 3 in both columns and calculate the the sum of the two minimum. BUT.!!!! I want progressively go tho width 3 starting… Read More How can I rollapply or slide in a data frame in R with sliding width as well?

Rollapply in R time frame indexing

Let’s say I have the following data frame of series. library(zoo) n=10 date = as.Date(1:n);d y = rnorm(10);y dat = data.frame(date,y) dat date y 1 1970-01-02 -0.02052313 2 1970-01-03 0.28255304 3 1970-01-04 -0.10718621 4 1970-01-05 -1.19299366 5 1970-01-06 1.17072468 6 1970-01-07 0.55849119 7 1970-01-08 0.30474050 8 1970-01-09 -0.30777180 9 1970-01-10 -0.01874367 10 1970-01-11 -0.74233556 Calculating… Read More Rollapply in R time frame indexing