在 R studio 中逐行调试 [英] line by line debugging in R studio

查看:36
本文介绍了在 R studio 中逐行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在R studio环境中逐行调试代码??

Is there a way to debug the code line by line in R studio environment ??

我知道有断点,下一步,继续等调试.但我正在寻找像 Visual Studio 中那样的逐行调试选项.

I know there are breakpoints, Next, continue etc to debug. But I am looking for a line by line debug option like the one in Visual Studio.

谢谢

推荐答案

debug 包可能就是您想要的.如果您通过此包进行调试,则会打开一个额外的窗口,其中显示您的代码,然后您可以结合 RStudio 逐行调试.

The debug package is probably what you want. If you are debugging via this package an extra window opens in which your code is displayed and then you can debug line by line in combination with RStudio.

有关如何使用 debug 包进行调试,请参见下面的示例代码:

See below example code for how to debug with the debug package:

install.packages("debug")
library(debug)

fun <- function(x) {
  y <- x + 1
  z <- y + 1
  return(z)
}

mtrace(fun)
fun(2)

这篇关于在 R studio 中逐行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆