The code I am using is tapply(g,?, mean), the tapply function but I am confused about what to put in between g which is my vector, and the mean. The question asks to get the mean of each set of 5 values in a vector of size 100. So I will have 20 means altogether. Any help is appreciated!
g<-c(1:100)
y<-rep(1:20, each=5)
tapply(g, y, mean)