Reputation: 2934
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?
Upvotes: 38
Views: 14315
Reputation: 11
You might want to check if every individual element and make sure it is a length of 1. In my case I had c <- (1:23)
fit[[c]]$results["Accuracy"]
some of it was length 1 but at index 3 it was length > 1
fit[[3]] I had the following ...
Accuracy
1 0.7764711
2 0.7771532
so I used max(fit[[3]]$results["Accuracy"])
for the ones that had length greater than one and then the mean function.
Upvotes: 0
Reputation: 1211
On mac, I usually use:
It helps even without restarting RStudio
Upvotes: 19
Reputation: 1375
Usually works for me...
Upvotes: 6
Reputation: 8126
This is a bug in RStudio. I frequently get it while writing my R code. This is all I always do and work:
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.
Upvotes: 54