Rscript - 摆脱“警告:忽略 R_HOME 的环境值”
Rscript 非常方便。但我想在运行时指定输出路径,例如: my.Rscript input >输出
。 message()
非常适合记录到 STDERR,但 Rscript 似乎会系统地将 警告:忽略 R_HOME 的环境值
输出到 STDOUT,即使指定 --vanilla< /code> 或
--no-environ
。
有什么解决方法吗?
(这是R脚本前端版本2.13.0(2011-04-13))
Rscript is very handy. But I'd like to specify output paths at runtime, e.g.: my.Rscript input > output
.message()
is great for logging to STDERR, but Rscript seems to systematically output WARNING: ignoring environment value of R_HOME
to STDOUT, even if specifying --vanilla
or --no-environ
.
Any workarounds?
(this is R scripting front-end version 2.13.0 (2011-04-13))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想这已经很老了。但是,使用 bash 等:
在运行 Rscript 之前应该可以解决问题。并且,使用 csh 等:
应该同样有效。由于 R 前端脚本设置了 R_HOME (在抱怨之后),我看不出有任何理由保留 R_HOME 设置。 (可能我错过了一些东西。)
i assume this is very old. but, with bash, etc.:
before running Rscript should do the trick. and, with csh, etc.:
should likewise work. since the R front-end script sets R_HOME (after complaining), i don't see any reason for leaving R_HOME set. (possibly i'm missing something.)
如果您知道脚本中的哪个 R 调用正在生成警告,则可以使用
suppressWarnings()
来包装生成警告的表达式。这肯定属于“解决方法”阵营。If you know which R call in the script is generating the warning,
suppressWarnings()
can be used to wrap the expression generating the warning. That is certainly in the "workaround" camp.