There are two ways to install packages in R.
If you want to install directly from a CRAN mirror, you will need to start an R session as root. DO NOT start modifying the permissions of the install directory... this can cause major problems and is a security issue.
Code:
sudo R
install.packages('pkg_name')
A window will then appear where you can choose the CRAN mirror to use. Once selected, it will install everything with the proper permissions. Once installed, exit R and start it again as a normal user.
You may also install from a local source if you have downloaded the package to your computer. This must also be done as sudo.
Code:
sudo R CMD INSTALL /home/username/pkg_name.tar.gz
Bookmarks