Rscript - 摆脱“警告:忽略 R_HOME 的环境值”

发布于 2024-11-16 07:29:28 字数 302 浏览 7 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傻比既视感 2024-11-23 07:29:28

我想这已经很老了。但是,使用 bash 等:

unset R_HOME

在运行 Rscript 之前应该可以解决问题。并且,使用 csh 等:

unsetenv R_HOME

应该同样有效。由于 R 前端脚本设置了 R_HOME (在抱怨之后),我看不出有任何理由保留 R_HOME 设置。 (可能我错过了一些东西。)

i assume this is very old. but, with bash, etc.:

unset R_HOME

before running Rscript should do the trick. and, with csh, etc.:

unsetenv R_HOME

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.)

許願樹丅啲祈禱 2024-11-23 07:29:28

如果您知道脚本中的哪个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文