You can convert the vectors to a matrix
and use colMeans
:
colMeans(matrix(v1,100))
[1] -0.09583398 0.01330998 0.11107002
colMeans(matrix(v2,100))
[1] -0.02396420 0.08638535 -0.03953273 0.09861287 0.01112838
Though beware of recycling if the cut size is not an exact multiple of the vector size. In which case, a split
-sapply
strategy will do the job:
sapply(split(v1,(seq_along(v1)-1)%/%200),mean)
0 1
-0.041262 0.111070