[R] ] Applying a certain formula to a repeated sample data: RESOLVED

2018-11-28 Thread Ogbos Okike
Dear Jeff, This is great to me!!! Many, many thanks. I have also clicked the send plain text mode button and I hope this message will appear in plain text mode. Thanks again. Warmest regards. Ogbos On Wed, Nov 28, 2018 at 7:06 AM Jeff Newmiller wrote: > > Thank you for providing a clarifying

Re: [R] Applying a certain formula to a repeated sample data

2018-11-27 Thread Jeff Newmiller
Thank you for providing a clarifying example. I think a useful function for you to get familiar with is the "ave" function. It is kind of like aggregate except that it works when the operation you want to apply to the group of elements will returns the same number of elements as were given to i

Re: [R] Applying a certain formula to a repeated sample data

2018-11-27 Thread Ogbos Okike
Dear Jim, I don't think my problem is clear the way I put. I have been trying to manually apply the formula to some rows. This is what I have done. I cut and past some rows from 1-7 and save each with a different file as shown below: 1 8590 12516 2 8641 98143 3 8705 98916 4 8750 89911 5 8685 10

Re: [R] Applying a certain formula to a repeated sample data

2018-11-27 Thread Ogbos Okike
Dear Jim, I wish also to use the means calculated and apply a certain formula on the same data frame. In particular, I would like to subtract the means of each of these seven days from each of the seven days and and divide the outcome by the same means. If I represent m1 by the means of each seven

[R] Applying a certain formula to a repeated sample data: SOLVED

2018-11-27 Thread Ogbos Okike
On Wed, Nov 28, 2018 at 4:31 AM Jim Lemon wrote: > Hi Ogbos, > If we assume that you have a 3 column data frame named oodf, how about: > > Dear Jim, Thank you so much. The code just made life very easier for me. best regards Ogbos > oodf[,4]<-floor((cumsum(oodf[,1])-1)/28) > col2means<-by(o

Re: [R] Applying a certain formula to a repeated sample data

2018-11-27 Thread Jim Lemon
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 wrote: > > Dear List, > I have three data-column

[R] Applying a certain formula to a repeated sample data

2018-11-27 Thread Ogbos Okike
Dear List, I have three data-column data. The data is of the form: 1 8590 12516 2 8641 98143 3 8705 98916 4 8750 89911 5 8685 104835 6 8629 121963 7 8676 77655 1 8577 81081 2 8593 83385 3 8642 112164 4 8708 103684 5 8622 83982 6 8593 75944 7 8600 97036 1 8650 104911 2 8730 114098 3 8731 99421 4 871