On a Linux system, without running R as the root user, we can install R packages and libraries in the user space.
By default, the installation directory is $HOME/R/library. What if we want to install it to a different directory without having
to specifying it on the R command line? For this, we can set R_LIBS environment variables to point to the directory.
For instance, if we wish to install the libraries to a hidden directory, e.g., the $HOME/.R/library directory, we can set it up
in the user profile, such as, in the .profile or .bash_profile file,
if [ -n $R_LIBS ]; then
R_LIBS="/home/hchen/.R/library":${R_LIBS}
else
R_LIBS="/home/hchen/.R/library"
fi
export R_LIBS
No comments:
Post a Comment