Install package and dependencies to a specific location. If you want the binaries cached, use destdir="/Rbins"
option. If you want the package(s) installed to a specific location, use lib="~/Rlibs"
. The default location on Windows is %userprofile%\Documents\R\win-library\3.0
.
install.packages("<package>", dependencies=NA, repos="http://cran.us.r-project.org")
R CMD INSTALL <package> -l ~/Rlibs
On Mac it would be something like
install.packages("<package>", dependencies=NA, type="mac.binary")
**If you don't use type
then it'll fall back to compiling and installing from source. This may happen anyway since not all packages are compiled for Mac.
Locations where libraries are pulled from:
.libPaths()
Add an entry to .libPaths()
.libPaths(c(.libPaths(), "/Rlibs"))
Load the library
library("<package>")
library("<package>", lib.loc="~/Rlibs")
Upgrade packages by following the steps in this SO answer.