Which, if any, R IDEs (e.g. StatET, Revolution R, RStudio, ESS, NppToR, others) support conditional breakpoints?
This is available via bp
in the debug
package, or via an additional bit of code that invokes browser()
based on a condition. However, it can be more efficient to be able to toggle a particular line # and quickly enter a conditional breakpoint for that particular line, without having additional code or console activities.
Note 1. I've searched a bit for these, and it seems that conditional breakpoints are not available in RStudio, and I think the same may be true for StatET. There appears to be support in ESS (see this page), though I'm not yet familiar with ess-tracebug and whether it's easy to use. It also seems that this works only for older versions of ESS; I'm not yet familiar with functionality for more recent versions.
Update 1. I'm selecting an answer (the only one - Andrie's). The question was answerable regarding whether any IDE supports conditional breakpoints, and, fortunately, Andrie has demonstrated that there exists a solution. I remain interested in any other IDEs that support this, though Eclipse is good enough for now. (At the moment, I prefer Rstudio, but this is already in their feature request list.) If anyone has expertise in ESS and can demonstrate that functionality, I'm sure it will benefit others who happen upon this question.
Yes, this is possible with Eclipse
+ StatET 2.0
in R 2.14-1
.
Eclipse
supports conditional debugging, and StatET 2.0
supports visual debugging (as long as you have a fairly recent version of R.)
Assuming you know your way around Eclipse, do the following:
With the debug perspective open, you will have a pane that contains tabs for Variables / Breakpoints
. In the breakpoints tab, select your breakpoint, then click the Conditional / Expression
tickbox and enter your condition.
In searching for this answer, I found the following pages helpful:
There is a little trick to set a conditional breakpoint in rstudio:
for(i in 1:10){
if(i==5){
print("set the breakpoint at this line by shift+f9")
}
i*i
}
The only drawback is you need to add some extra code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With