Rscript issue - using different version of R?

我与影子孤独终老i 提交于 2019-12-31 04:03:12

问题


I'm trying to load a library in an Rscript, but it's giving me a strange error. I'm running the 2.12.1 version of the Rscript binary, yet it complains that my package was built under version 2.12.1. Any idea what's going on here?

    [17:55:13 trash] $ ./tmp.R 
    Loading required package: blah
    Error: (converted from warning) package 'blah' was built under R version 2.12.1


    [17:55:47 trash] $ cat tmp.R 
    #!/path/to/R/2.12.1/bin/Rscript --quiet
    library(blah)

回答1:


I figured it out with help from comments by @aL3xa and @Iterator. When I run whereis Rscript, I get:

Rscript: /usr/bin/Rscript /usr/bin/X11/Rscript

None of those represents the R installation I want to use (version 3.2.2 in this case), which would be located at

/myinstall/R-3.2.2/bin/

But if I run the Rscript command with the whole path, I force it to use the desired installation:

/myinstall/R-3.2.2/bin/Rscript tmp.R

which runs like a breeze.



来源:https://stackoverflow.com/questions/7935708/rscript-issue-using-different-version-of-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!