[R] 'for Loop'
Erich Neuwirth
erich.neuwirth at univie.ac.at
Tue Mar 31 19:14:43 CEST 2009
If you add 2 numbers a and b and divide this sum
by the mean of these 2 number, you will always get 2
(a+b)/((a+b)/2) always simplifies to 2.
Alan O'Loughlin 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 at 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.
>
>
--
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
More information about the R-help
mailing list