Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting breakpoints in RStudio during package development

Tags:

rstudio

I am developing a package in RStudio and would like to use breakpoints to debug my functions. However, I keep running into the same problem: I set a breakpoint, RStudio warns me that the package has to be built and reloaded to activate the breakpoint (even if I just built and reloaded the package), and then when I build and reload the package the breakpoint disappears. Is there something I am not understanding?

like image 437
eamcvey Avatar asked Sep 12 '14 16:09

eamcvey


People also ask

How do I set a breakpoint in RStudio?

The most common (and easiest) way to stop on a line of code is to set a breakpoint on that line. You can do this in RStudio by clicking to the left of the line number in the editor, or by pressing Shift+F9 with your cursor on the desired line. We call this an “editor breakpoint”.

How do you enter debug mode in RStudio?

Options in RStudio In addition to debug() and browser(), you can also enter debug mode by setting “editor breakpoints” in RStudio by clicking to the left of the line in RStudio, or by selecting the line and typing shift+F9.

What is the purpose of using breakpoints during execution of a program?

Breakpoints are most commonly used to interrupt a running program immediately before the execution of a programmer-specified instruction. This is often referred to as an instruction breakpoint.


1 Answers

move your .R file to the directory that .RData exist and then setwd("directory of .RData file").

this solution worked for me!

like image 111
mrdm Avatar answered Sep 20 '22 12:09

mrdm