Skip to content
Prev 307623 / 398506 Next

practical to loop over 2million rows?

This is a classic example from my tag line:

Tell me what  you want to do, not how you want to do it.

For example you provided no information as to what the objects were.
I hope that 'stratID' is at least of length one greater than 'x' based
on your loops.  Also on the last iteration you are trying to access an
element outside of x (x[length(x) + 1]).

The first part is easy for setting 'y'

indx <- !is.na(x)
y[indx] <- x[indx]

For the second part you can do something like:

indx <- head(stratID, -1) == tail(stratID, -1)  # get the comparison

but since you did not provide any data, the rest is left to the reader.
On Wed, Oct 10, 2012 at 5:16 PM, David Winsemius <dwinsemius at comcast.net> wrote: