浏览器继续执行后() [英] Continue executing after browser()
本文介绍了浏览器继续执行后()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我调试R code。与的浏览器()。
该功能暂停电流R脚本的执行,并允许进行检查。
是否有可能以启用/禁用动态调试模式中,在执行过程中?
随着大量的脚本这将是非常方便的。
I'm debugging R code with browser(). The function pauses the execution of the current R script and allows for inspection. Is it possible to enable/disable the debug mode on the fly, during the execution? With large scripts it would be very handy.
感谢
推荐答案
您的问题促使我读?浏览器
。文档说,你可以使用 EXPR =
参数浏览器
以创建条件调试(幻觉)。也就是说,具有全局选项组合应该给你你想要的东西。
Your question prompted me to read ?browser
. The documentation says you can use the expr=
argument to browser
to create (the illusion) of conditional debugging. That, combined with a global option should give you what you want.
foo <- function(x) {
browser(expr=isTRUE(getOption("myDebug")))
mean(x)
}
foo(1:10)
options(myDebug=TRUE)
foo(1:10) # invokes browser
这篇关于浏览器继续执行后()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文