search for: strataid

Displaying 1 result from an estimated 1 matches for "strataid".

Did you mean: strata
2012 Oct 10
3
practical to loop over 2million rows?
...eems that even with these speed ups I might have too much data to run loops. Here is the loop I ran that took 13 minutes. I realize I can accomplish the same goal using vectorization (and in fact did so). y<-numeric(length(x)) for(i in 1:length(x)) ifelse(!is.na(x[i]), y[i]<-x[i], ifelse(strataID[i+1]==strataID[i], y<-x[i+1], y<-x[i-1])) Presumably, complicated loops would be more intensive than the nested if statement above. If I write more efficient loops time will come down but I wonder if I will ever be able to write efficient enough code to perform a complicated loop over 2 mill...