在R语言中调试时,是否可以绕过stop()
并使其成为我要单步执行的代码?
myfun <-
function(){
browser()
stop("any way around this?")
print("code that i want to step through")
TRUE
}
myfun()
最佳答案
你可以屏蔽停止
:
> myfun()
Called from: myfun()
Browse[1]> stop <- message
Browse[1]> n
debug at #4: stop("any way around this?")
Browse[2]> n
any way around this?
debug at #6: print("code that i want to step through")
Browse[2]> stop <- base::stop
Browse[2]> n
[1] "code that i want to step through"
debug at #8: [1] TRUE
Browse[2]> n
[1] TRUE
关于r - 如何在调试 session 期间跳过命令或代码行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58838605/