Is there a way to debug the code line by line in R studio environment ??
I know there are breakpoints, Next, continue etc to debug. But I am looking for a line by line debug option like the one in Visual Studio.
Thank you
For R-Studio newbies like me that are used to other IDEs:
a) Set a break point by clicking on the border or pressing Shift+F9
(=>red break point dot is shown)
b) As equivalent to "Debug" in other IDEs:
source
or Ctrl+Shift+Enter
or source on save
and savec) Have a look at the Console
view. There are common debug options:
F10
Shift+F4
Shift+F6
Shift+F5
Shift+F8
(Unfortunately I did not find a way to adapt the key shortcuts for those options. They are not listed under Tools=>Modify Keyboard shortcuts.)
d) There does not seem to be a "hover over expression" feature while debugging. You can have a look at the Environment
view to see the value of a variable and use the Console to evaluate expressions while debugging.
If you want to run the script without debugging and without clearing the break points, select all lines Ctrl+A
and use the Run button. (Seems to be complicated to me.... I would expect an extra run button or key shortcut for that but could not find one.)
If there is no selection, the Run button only executes the current line. You can press that button several times to step through the code and see the corresponding console output (=pseudo debugging).
Also see documentation at
https://support.rstudio.com/hc/en-us/articles/200484448-Editing-and-Executing-Code
https://support.rstudio.com/hc/en-us/articles/205612627-Debugging-with-RStudio
and related questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With