Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Rscript 非常好用。但我想在运行时指定输出路径,例如:my.Rscript input > output. message()非常适合记录到 STDERR,但 Rscript 似乎系统地输出WARNING: ignoring environment value of R_HOME到 STDOUT,即使指定--vanillaor --no-environ。
my.Rscript input > output
message()
WARNING: ignoring environment value of R_HOME
--vanilla
--no-environ
任何解决方法?
(这是 R 脚本前端版本 2.13.0 (2011-04-13))
我想这已经很老了。但是,使用 bash 等:
unset R_HOME
在运行 Rscript 之前应该可以解决问题。并且,使用 csh 等:
unsetenv R_HOME
应该同样工作。由于 R 前端脚本设置了 R_HOME(在抱怨之后),我看不出有任何理由让 R_HOME 设置。(可能我错过了一些东西。)
如果您知道脚本中的哪个 R 调用正在生成警告,suppressWarnings()则可用于包装生成警告的表达式。那肯定是在“解决方法”阵营中。
suppressWarnings()