RStudio 会针对每个函数错误进入调试模式——我该如何停止它?

RStudio enters debug mode for every function error - how can I stop it?

我使用 RStudio 已经很多年了,以前从未发生过这种情况。出于某种原因,每次函数抛出错误时,RStudio 都会进入调试模式(我不希望这样)。即使在单个函数上使用 undebug() 之后。

> undebug(http.get)
Warning message:
In undebug(fun) : argument is not being debugged
> x = http.get(country = 'KE')

http --timeout=60 get "http://foo@bar.com/observation?country=KE" > freshobs.json </dev/null
Error in fromJSON(file = "freshobs.json") : unexpected character 'O'

Error in el[["product_name"]] : subscript out of bounds
Called from: grepl(el[["product_name"]], pattern = "json:", fixed = T)
Browse[1]> Q

我使用的任何函数中断都会导致调试模式启动 - 这非常烦人,因为它会打开源代码查看器并让您远离代码。有人知道如何停止此功能吗? 当首选项中的 'Use debug mode only when my code contains errors' 复选框被选中和未被选中时,就会发生这种情况。

谢谢!

好吧,我想我已经修复了它。不知道这是怎么发生的,但在 Rstudio 中,运行ning

> options()$error # returned:
 (function () 
{
    .rs.breakOnError(FALSE)
})()

当从终端 运行ning R 时,同样的事情返回 NULL。 --> 我 运行:

options(error=NULL)

这解决了问题 - 但只是暂时的。当我退出并重新启动 Rstudio 时,代码需要再次 运行。当我找到更改默认值的方法时会更新...干杯。

我尝试通过将 options(error = NULL) 放入我的 .Rprofile 来解决这个问题,但这没有用。

工作是去"Debug" -> "On Error" menu and select "Message only"。这实际上与设置 options(error = NULL) 相同,但它在重新启动后保持不变。

reset my RStudio Desktop preferences 然后问题就解决了。

请注意,此重置后的 options()$error return 值为:

(function () 
{
    .rs.recordTraceback(TRUE, 5, .rs.enqueueError)
})()

此更改前的值是根据 comment above

对我没有任何作用:我有一个函数,当我 运行 继续调试时。

我的解决方案是(请谨慎):Debug (menü) -> clear All Breakpoints ...

我在 RStudio Cloud 中遇到了同样的问题。通过选择不同版本的 R 解决了这个问题。 我用的是R3.6.0,改成了R3.5.3(右上角的选项)。它刷新了控制台,调试停止了。然后 R3.6.0 又好了。 干杯。