When I am in debug mode in a function and uses "CTRL + Enter" on an object/variable, R takes me back on line 1 of the function and prints the object variable to the console. Is this a bug or an expected behavior?
Another bug in debug mode: - If there is a print(variable1) somewhere in the function, R will not only print to the console variable1 but also the remaining function code that comes after "print(variable1)"
Are there any ways of avoiding those behaviors of R Studio?
Thanks,
This may be worth reporting to rstudio directly as it may be a bug that was left over from a change of behavior in debug mode. I looked through the browser
help file and didn't come across this behavior.
An rstudio article from April 2016 on debugging here, states that
Simply pressing Enter at the console will execute the current statement and move on to the next one. This is a convenient way to step through statements quickly.
Note that most of the commands listed in this section directly match with the behavior of browser
.
However, I've been reading Hadley's Advanced R recently and came across the following in section 3.2.2:
There are two other slightly less useful commands that aren’t available in the toolbar:
* Enter: repeats the previous command. I find this too easy to activate accidentally, so I turn it off using options(browserNLdisabled = TRUE).
...
Since Advanced R was published in 2014, my thinking is that this is legacy behavior that you should report to the makers of rstudio, complete with a reproducible example.
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