问题
Similar to this question which has no working answer.
I am attempting to use Rscript on linux redhat 6.6, however Rscript uses the incorrect R version. How can I get Rscript to use the latest R version?
Running Rscript --version
yields
R scripting front-end version 2.13.0 (2011-04-13)
Whereas running R
yields:
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
Whereis on both R and Rscript yields the following:
[]$ whereis R
R: /usr/local/bin/R
[]$ whereis Rscript
Rscript: /usr/local/bin/Rscript
Which yields the following:
[rd02@ipgrd02 ~]$ which Rscript
/usr/local/bin/Rscript
[rd02@ipgrd02 ~]$ which R
/usr/local/bin/R
rpm -qa |egrep ^R
yields the following:
[rd02@ipgrd02 ~]$ rpm -qa | egrep ^R
Red_Hat_Enterprise_Linux-Release_Notes-6-en-US-6-2.el6.noarch
I think it has something to do with bashrc/bash_profile but I cannot find anything that helps me on google.
回答1:
It appears to me that you have installed R outside the package manager. On a CentOS/RedHat 7.x platform the same installation looks like this:
#which Rscript
/bin/Rscript
#which R
/bin/R
#rpm -qa | egrep ^R
R-core-3.2.3-4.el7.x86_64
R-3.2.3-4.el7.x86_64
R-core-devel-3.2.3-4.el7.x86_64
R-devel-3.2.3-4.el7.x86_64
R-java-3.2.3-4.el7.x86_64
R-java-devel-3.2.3-4.el7.x86_64
#whereis R
R: /usr/bin/R /usr/lib64/R /usr/include/R /usr/share/R /usr/share/man/man1/R.1.gz
#whereis Rscript
Rscript: /usr/bin/Rscript /usr/share/man/man1/Rscript.1.gz
Would you mind clarifying how the packages got installed?
I have the following on my system:
#Rscript --version
R scripting front-end version 3.2.3 (2015-12-10)
#R
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
来源:https://stackoverflow.com/questions/35646882/rscript-using-incorrect-r-version