Debugger stops at incorrect line


I have a peculiar problem: the debugger stops at a line that is far off from the place I mark the debugger to stop. I have sourced the .r file multiple times, changed the location of the debugging point (the red dot) many times but as soon as I source the file it stops at one line which is far off from the line I is this one (the code may not make sense as itis out of context) but I can't possibly paste all the lines of code.

rows_to_ignore <- ifelse(dt_ignore$col+1==dt_ignore$i.col,dt_ignore$row,NULL)



Could you paste a few lines of code around it, just enough so someone else can replicate? Thanks.
Also, what versions of R and RStudio are you using? (again, for replication purposes)



I am trying to replicate the problem by changing the location of debugging point. I encounter this new error when I change the debug point to a few lines up or down. But this goes away after I remove the debug point and again add it.

Error in fBody[[i]] : subscript out of bounds

Mara - I can copy a few lines of code but you won't be able to run it as obviously the first error you may get will be: object 'varname' not found

I can load a screencast video if that helps.



I second a minimal reproducible example as well, but failing that a link to a screencast could help.

The error message you cite has a pretty straightforward meaning though. In the list fBody there simply isn't an ith value. If fBody is a data.frame, then there isn't an ith column.



Here's the screencast that demonstrates the problem.

The RStudio.Version is 1.0.143

1 Like


It seems that the video is unavailable.



My apologies.. set the permission to unlisted now. Please try again.

1 Like


I have upgraded RStudio and hopefully this problem will not recur. If it recurs we will open the same track. Now I am closing this.



Even after RStudio upgrade, the problem resurfaced.

Although in the current manifestation it is slightly clear what is happening...and I guess someone may be able to suggest an immediate solution.

There is a red circle at the point - not a solid red dot, which it should become after sourcing the code. That looks to be the root cause of the invisible debug point.

I attach another screencast capture - now on the new version of RStudio.

This is RStudio version 1.1.447

Sticky debug point



I noticed the same issue. Although more precisely, if I set a breakpoint on a line that is not an if condition, all is fine. But when I do set the breakpoint on an if line, the screen seems to show more or less the middle of the section encapsulated between the brackets following the if condition.