[R] vectorization condition counting

Guillaume2883 guillaume.bal.pro at gmail.com
Sat Aug 11 00:46:40 CEST 2012


Hi all,

I am working on a really big dataset and I would like to vectorize a
condition in a if loop to improve speed.

the original loop with the condition is currently writen as follow:

if(sum(as.integer(tags$tag_id==tags$tag_id[i]))==1&tags$lgth[i]<300){
    
     tags$stage[i]<-"J"
    
   }

Do you have some ideas ? I was unable to do it correctly
Thanking you in advance for your help

Guillaume



--
View this message in context: http://r.789695.n4.nabble.com/vectorization-condition-counting-tp4639992.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list