RStudio为每个功能错误进入调试模式 - 我该如何阻止它?

时间:2015-03-12 19:40:56

标签: r debugging rstudio

我多年来一直在使用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

我使用的任何函数都会导致调试模式启动 - 这非常烦人,因为它打开了一个源查看器并带你离开代码。有谁知道如何停止这项功能? 只有当我的代码包含错误时才会使用调试模式。 “首选项”中的复选框是并且未选中。

谢谢!

5 个答案:

答案 0 :(得分:30)

我尝试通过将options(error = NULL)放入.Rprofile来解决此问题,但这不起作用。

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

RStudio menu

答案 1 :(得分:1)

嗯,我想我有点修复它。不知道这是怎么发生的,但在Rstudio中,正在运行

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

从终端运行R时,同样的东西返回NULL。 - &GT;我跑了:

options(error=NULL)

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

答案 2 :(得分:0)

reset my RStudio Desktop preferences,问题就消失了。

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

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

此更改前的值为每comment above

答案 3 :(得分:0)

没有什么对我有用:我有一个功能,当我运行时继续调试。

解决方案对我来说(谨慎):Debug (menü) -> clear All Breakpoints ...

答案 4 :(得分:0)

我在RStudio Cloud中遇到了同样的问题。通过选择其他版本的R解决了该问题。 我使用的是R3.6.0,并将其更改为R3.5.3(右上角的选项)。它刷新了控制台,调试停止。然后R3.6.0再次正常。 干杯。