[R] help with loop

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Thu Mar 12 14:22:30 CET 2009


> I'm trying to write a loop to sum my data in the following way:
> (the second - the first) + (the third - the second) + (the fourth - 
> the third) + ...
> for each column.

This is just sum(diff(x)), or even x[length(x)] - x[1].

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list