[R] how to define .Renviron to work with different R-versions
Poornima Reddy
isha.poornima at gmail.com
Wed May 7 18:51:13 CEST 2008
Hi,
I have a simple R script for printing arguments
cat > printargs.R << EOF
args = commandArgs()
print(args)
q()
EOF
To run this script, first I set PATH to ~/src/R-2.6.2 and execute >
R --no-save < printargs.R
I want to run this script with different R versions by defining an
.Renviron file in the same directory as printargs.R
cat > .Renviron << EOF
R_VERISON=R-2.7.0
R_HOME=~/src/${R_VERSION}
PATH=${R_HOME}/bin:${PATH}
R_LIBS=${R_HOME}/library
EOF
Now when I run > R --no-save < printargs.R, I get
Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") : cannot open compressed file
'/home/ppreddy/src//library/base/R/base.rdx', probable reason 'No such
file or directory'
Execution halted
I do not know for sure, if I can define R_VERSION, R_HOME, and PATH
in .Renviron. All I have seen is defining R_LIBS/JAV_HOME in r-help
archives.
So, please explain how to use the .Renviron to work with
R-different R-versions and also Should I place .Renviron in the home
dir instead of cwd?
Thanks,
Poornima.
More information about the R-help
mailing list