调试中恼人的 RStudio 行为
Annoying RStudio Behavior in debugging
当我在函数中处于调试模式并在 object/variable 上使用 "CTRL + Enter" 时,R 将我带回到函数的第 1 行并将对象变量打印到控制台。这是错误还是预期行为?
调试模式中的另一个错误:
- 如果函数中某处有 print(variable1),R 不仅会打印到控制台 variable1,还会打印 "print(variable1)"
之后的剩余函数代码
是否有任何方法可以避免 R Studio 的这些行为?
谢谢,
这可能值得直接向 rstudio 报告,因为它可能是调试模式下行为更改遗留下来的错误。我查看了 browser
帮助文件,但没有遇到这种行为。
一篇 2016 年 4 月关于调试 here 的 rstudio 文章指出
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.
请注意,本节中列出的大多数命令与 browser
的行为直接匹配。
不过,我最近一直在阅读 Hadley 的 Advanced R,并在 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).
...
自从 Advanced R 于 2014 年发布以来,我认为这是遗留行为,您应该向 rstudio 的制造商报告,并附上可重现的示例。
当我在函数中处于调试模式并在 object/variable 上使用 "CTRL + Enter" 时,R 将我带回到函数的第 1 行并将对象变量打印到控制台。这是错误还是预期行为?
调试模式中的另一个错误: - 如果函数中某处有 print(variable1),R 不仅会打印到控制台 variable1,还会打印 "print(variable1)"
之后的剩余函数代码是否有任何方法可以避免 R Studio 的这些行为?
谢谢,
这可能值得直接向 rstudio 报告,因为它可能是调试模式下行为更改遗留下来的错误。我查看了 browser
帮助文件,但没有遇到这种行为。
一篇 2016 年 4 月关于调试 here 的 rstudio 文章指出
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.
请注意,本节中列出的大多数命令与 browser
的行为直接匹配。
不过,我最近一直在阅读 Hadley 的 Advanced R,并在 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).
...
自从 Advanced R 于 2014 年发布以来,我认为这是遗留行为,您应该向 rstudio 的制造商报告,并附上可重现的示例。