You can install and execute your own R packages in non-system directories. This is handy when you're working on machines without system access. To avoid network and computational degradation, the directories for your personal packages should be placed on the local hard drive of the machine. Local directories include: /Users/Shared/<username> (on any machine), /data/<username> (on computation servers).
The directory can be named whatever you want. Let's assume, for this example, that the directory is named "myRlibs" and that it is located under the /Users/Shared/<username> directory. It can be created from the Terminal shell with the following command:
mkdir -p /Users/Shared/<username>/myRlibs
setenv R_LIBS /Users/Shared/<username>/myRlibsIn bash:
export R_LIBS=/Users/Shared/<username>/myRlibsThese settings can be saved in ~/.tcshrc (for tcsh users) or ~/.profile (for bash users).
.libPaths();This will show you a list of directories where packages are installed. You should see the system directory and the directory that was defined in step 1.
install.packages("aaMI_1.0-1",lib="/Users/Shared/<username>/myRlibs",epos=NULL);You should see that the package is installed in /Users/Shared/<username>/myRlibs. With the R_LIBS environment variable set to include this directory, all future R sessions will now find this package.