[R] debug in a loop

ikuzar razuki at hotmail.fr
Fri Feb 10 16:22:57 CET 2012


Hi, 

I'd like to debug in a loop (using debug() and browser() etc but not print()
). I'am looking for the first occurence of NA.
For instance:

tab = c(1:300)
tab[250] = NA
len = length(tab)
for (i in 1:len){
   if(i != len){
     tab[i] = tab[i]+tab[i+1]
   }
}

I do not want to do "Browse[2]> n" for each step ... I'd like to declare a
"browser()" in the loop with a condition. But how to write "stop running
when you encounter NA" ?

Thanks for your help

--
View this message in context: http://r.789695.n4.nabble.com/debug-in-a-loop-tp4376563p4376563.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list