Al, Is there any "ID" index for the pairs? For example, if the first pair can be labeled "a", and second pair labeled "b" etc., then you can add an index column or you may already have such a column in your list. Then run aggregate(your.data.column, by=index.column, FUN=mean). Or you can just add an extra index column anyway rep(1:number of the rows/2, each=2). Hope this helps.
-- Jun Shen PhD PK/PD Scientist BioPharma Services Millipore Corporation 15 Research Park Dr. St Charles, MO 63304 Direct: 636-720-1589 On Tue, Mar 31, 2009 at 10:40 AM, Alan O'Loughlin <olo...@wyeth.com> wrote: > Hello, > > I'm trying to create a for loop for a data set, I have a list of results in > this data set and I want to take the 1st two add them together and divide by > the mean of the 1st to, then do the same for the 3rd and 4th values in the > list and so on and each time return a value for the calculation on each > pair. > > Any help would be appreciated. > > Thanks, > Al > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.