I have 2 large set of data, each have 2000+ data and trying to find the covariance for every 5 row.
x=c(1,2,3,4,5)
y=c(6,7,8,9,10)
df=data.frame(x,y)
group=rep(1:length(df),each=2,length=length(df))
What is my next step so I can find the covariance like this`
cov(x[1:2,],y[1:2,])
and
cov(x[3:4,],y[3:4,])