如何在Rstudio中调试单独的代码块?
R内核要求在激活任何断点之前“来源”文件 - 这意味着您必须先在控制台中有效地执行整个脚本。只有在您的脚本短而分开的块和独立功能(例如一袋工具)中,这是可以接受的。但是,如果您的脚本由原始的代码线组成,这些代码线无法很好地工作,有些甚至不工作或错误?
是否有比切换到Jupyter笔记本以从其“单元”中受益更好的解决方案?
R kernel requires the file to be 'sourced' before any breakpoints can be activated - meaning you have to effectively execute the whole script in the console first. This only is acceptable if your scripts are either divided in short and well separated chunks and standalone functions, like a bag of tools. But what if your script consists of raw lines of code which are not working well together, and some even not working or bugged?
Is there a better solution than switching to Jupyter Notebook to benefit from its 'cells'?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在rstudio中,您可以运行任意数量的代码行( link )并查看环境中的输出。
如果您要进行调试,也可以使用诸如browser(),debug()和debugonce()之类的功能。
In RStudio, you can run any number of lines of code (LINK) and view the output in the environment.
If you're debugging, you can also use functions such as browser(), debug(), and debugonce().