Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: Error in fBody[[i]] : no such index at level 4

Debug mode in R sometimes throws out the following error:

     Error in fBody[[i]] : no such index at level 4

What causes this? And how to avoid it?

like image 979
Massyanya Avatar asked Jun 29 '15 13:06

Massyanya


3 Answers

This is a bug in RStudio. I frequently get it while writing my R code. This is all I always do and work:

  1. Restarted RStudio
  2. Clear all breakpoints (there is a menu for that)
  3. Cut the entire source code, the file you want to debug. Save the empty file.
  4. Paste the source code. Save it.

The bug has something to do with position of the breakpoints. For some reason, RStudio is confused the new breakpoints with something else. By cutting and pasting the source code, we are forcing RStudio to "forget" the old breakpoints and start refresh. It's like giving a new file to RStudio.

Now, you can run a debug session again.

RStudio developers, please fix this stupid bug.

like image 133
SmallChess Avatar answered Nov 03 '22 18:11

SmallChess


On mac, I usually use:

  1. Save file
  2. Debug->Clear All Breakpoints.

It helps even without restarting RStudio

like image 30
Artem Zaika Avatar answered Nov 03 '22 17:11

Artem Zaika


  1. Save file without breakpoints
  2. Session -> Restart R

Usually works for me...

like image 6
Albert James Teddy Avatar answered Nov 03 '22 19:11

Albert James Teddy