I have data with 7 columns and 21 rows, and I want to create the for loop. I want to calculate the mean for first column in this data for fist 10 rows. And then I want to calculate second average for rows from 2 to 11, then from 3 to 12 and to the last from 11 to 20 row. I tried to do this by these code:
sredniaa <- array(0, 11)
for(j in 1:11) {
sredniaa[j]<-mean(wartdop1[j:j+9,1])
}
but it doesn't work. Anyone know how to do that? My data is on image: