Skip to content
Prev 377572 / 398502 Next

Applying a certain formula to a repeated sample data

Hi Ogbos,
If we assume that you have a 3 column data frame named oodf, how about:

oodf[,4]<-floor((cumsum(oodf[,1])-1)/28)
col2means<-by(oodf[,2],oodf[,4],mean)
col3means<-by(oodf[,3],oodf[,4],mean)

Jim
On Wed, Nov 28, 2018 at 2:06 PM Ogbos Okike <giftedlife2014 at gmail.com> wrote: