Re: [R] Differencing data by groups

2007-10-12 Thread jim holtman
What problem are you actually having with 'diff'? Now if you are using 'diff', you will get a vector that is shorter by one than the original. Now do you want to do do something like: Xbar = Sum{c(Depth[1], diff(Depth))*temp}/Sum(c(Depth[1], diff(Depth)) On 10/12/07, Thomas Miller <[EMAIL PROTE

[R] Differencing data by groups

2007-10-12 Thread Thomas Miller
Colleagues, I am analyzing data collected during oceanographic cruises. We have conducted many cruises over the last decade. On each cruise we visit ~50 stations. At each station (termed EventNum)we lower an instrument that measures depth, temperature, salinity and oxygen every few seconds as it