Re: [R] debug in a loop

2012-02-11 Thread Duncan Murdoch
On 12-02-10 12:48 PM, Justin Haynes wrote: You can add if(is.na(tab[i])) browser() or if(is.na(tab[i])) break see inline You can also do this temporarily. Supposing that you used source(foo.R) to enter a function with that code in it, and you want the check on line 10, you'd enter

[R] debug in a loop

2012-02-10 Thread ikuzar
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

Re: [R] debug in a loop

2012-02-10 Thread Justin Haynes
You can add if(is.na(tab[i])) browser() or if(is.na(tab[i])) break see inline On Fri, Feb 10, 2012 at 7:22 AM, ikuzar raz...@hotmail.fr wrote: 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: