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.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to