r - 如何在调试 session 期间跳过命令或代码行

标签 r debugging

在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/

相关文章:

r - 为数据框中的所有字符串分配相同的值

r - 如何通过分解包含 r 中向量的列来拉伸(stretch)数据框?

r - 我可以在同一个 `j` 参数中使用在 `j` 中新创建的变量吗?

java - IDEA中如何跟踪对一个对象的所有操作

r - server.conf 文件保存在哪里 openCPU ubuntu

r - 在 R 中贬低多个级别的数据

c# - Visual Studio For Mac 调试单元测试

visual-studio - Visual Studio 调试 - 忽略一个地方的异常,同时在其他地方打破它?

php - Docker 和 XDebug 不读取断点 VSCode

python - 如何在 Python 的调试器中查看异常的详细信息?