Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to skip through a loop when debugging R code

Tags:

r

debugging

I am new debugging in R using traceback() and option(error=recover) and debug(function) to try to find the reason of an error I have in an R package.

I am debugging a function with a big loop and I want to 'step out' of the loop into the next block. How can I do that? I know that you can put breakpoints, but I don't know where the loop is nor which is the next step. I am in an only text environment so the graphical help of the debug package probably does not help.

To sum up, how to step out of a loop when debugging, and how to step into a function for debug when you are already debugging?

Probably this has been already answered and I have missed it. I have seen several SO R debug question but none answering this part that I am aware.

like image 686
Pablo Marin-Garcia Avatar asked Dec 12 '11 17:12

Pablo Marin-Garcia


People also ask

How do I skip a loop in debugging?

You can add a breakpoint after the loop and click F8 (resume). The debugger will stop on the next found breakpoint, e.g. you will have skipped the loop(s).

How do I skip a line while debugging in Visual Studio?

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.


1 Answers

I'm fairly sure R's help system works even if you're not using a GUI. Try typing ?debug and see what happens. You ought to be informed that typing c or cont will

continue to the end of the current context: e.g. to the end of the loop if within a loop or to the end of the function.

like image 65
joran Avatar answered Oct 19 '22 23:10

joran