Check your R to find the path of the R library
> .libPaths()
"/usr/lib/R/library" "/usr/share/R/library"
This is what appears originally. Then you can make some adjustment with the path of library first, suppose you did install package through
$R CMD INSTALL -l lib/R lib/'packagename'.tar.gz
then it is instantly install in your predestined folder
/lib/R
Then in that folder you have your package to be installed. In case of that, do this in R
> library(packagename, lib.loc="~/lib/R")
Then it's done! Otherwise, there is another way by change the R_LIB in ./cshrc (or ./bashrc) by edit the alias in ./cshrc by the following
if ($?R_LIBS) then
setenv R_LIBS~/lib/R:$R_LIBS
else
setenv R_LIBS~/lib/R
endif
And then source the new edited ./cshrc then
> .libPaths()
"~/lib/R" "/usr/lib/R/library" "/usr/share/R/library"
you are done!
No comments:
Post a Comment