Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually Downloading and Installing Packages in R

Tags:

r

I am currently trying to run some R code on a computing cluster but cannot run the install.packages function due to some weird firewall settings on my cluster. Since I am only using a few packages in my R code, I was hoping to avoid using the install.packages function by downloading and installing the packages manually.

Note: I am aware that there is a way to avoid this issue by using an HTTP proxy as described in the R FAQ. Unfortunately the people in charge of my cluster are not being helpful in setting this up so I'm forced to consider this alternative approach.

Ideally, I would like to download the packages files from CRAN to my computer, then upload these files to the cluster and install them using the appropriate commands in R. In addition, I would also like to make sure that the packages are installed to a location of my choice since I do not have the permission to "write" in the default R directory (I believe that I can do this within R by using the .libPaths function)

Lastly, the computers that I am working with on the cluster are Unix x86_64.

like image 479
Berk U. Avatar asked Feb 11 '13 05:02

Berk U.


2 Answers

You can install the package manually using the following command

install.packages('package.zip', lib='destination_directory',repos = NULL)

See the help of ?install.packages, for further description

like image 131
iTech Avatar answered Oct 09 '22 05:10

iTech


this the better way, if we want to download and install locally :

download.packages('lib_name',destdir='dest_path') 

for example :

download.packages('RJDBC',destdir='d:/rlibs') 
like image 25
adramazany Avatar answered Oct 09 '22 06:10

adramazany