General problem installing any R package

Problem

When trying to install any R package on your system, for example:

install.packages("proto")

 

you get an error like the following:

The downloaded source packages are in
?/tmp/Rtmph4YKLX/downloaded_packages?
Updating HTML index of packages in '.Library'
Warning in install.packages :
cannot create file
'/opt/POC/lib64/Revo-7.3/R-3.1.1/lib64/R/doc/html/packages.html', reason
'Permission denied'

Solution

This error will occur when you do not have the necessary file permissions to be able to write to the current R library folder as the user 

you are currently logged in as.   You can use the R function '.libPaths()' to both query and change the current location R will use to install new user-contributed libraries.

For example:

>.libPaths("/home/testuser/Rlib")

 

To change the default location in which to add R user contributed libraries permanently, you can add this to your user-specific  .'Rprofile' file or to the system-wide '.Rprofile.site'  in '/usr/lib64/Revo-7.3/R-3.1.1/lib64/R/etc', if you need to change this setting for all of your R users.
Properties

Article ID: 3103821 - Last Review: Nov 1, 2015 - Revision: 1

Revolution Analytics

Feedback