是否 R 提供类似的调试命令,如 Matlab 的 keyboard
?
此命令提供了一个交互式 shell,可以在任何函数中使用。
这可以访问所有变量,从而可以验证输入数据是否确实是它应该的样子(或测试为什么它没有按预期工作)。
使调试更容易(至少在 Matlab 中...)。
最佳答案
听起来您正在寻找 browser()
.
从描述来看:
A call to ‘browser’ can be included in the body of a function. When reached, this causes a pause in the execution of the current expression and allows access to the R interpreter.
听起来您是 R 调试新手,所以您可能需要阅读 Hadley's wiki page on debugging .
关于R:与 Matlab 的键盘功能等效的命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18113921/