14

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

Yannick Wurm
  • 3,617
  • 6
  • 25
  • 28
  • 4
    What if you don't *want* it to ignore `R_HOME`? I get this error message when I run `R RHOME`, and it's using `/usr/lib/R` instead of `/home/mohawkjohn/R` (which I specified in my `.bashrc`). – Translunar Apr 30 '13 at 20:53

2 Answers2

6

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

John Conde
  • 217,595
  • 99
  • 455
  • 496
Greg Minshall
  • 547
  • 5
  • 6
0

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.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453