bibinwilson
bibinwilson

Reputation: 358

How to install R packages in Linux cluster

I got cluster account from my college, and got installed R 2.13.0 in linux cluster(redhat 2.6.18-128.el5) but I'm not able to install r packages. I tried the following codes

  1. install.packages('plyr') and I selected the CRAN mirror as 1. then I got the following msg.

Warning: unable to access index for repository http://cran.ms.unimelb.edu.au/src/contrib Warning messages: 1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org' 2: In getDependencies(pkgs, dependencies, available, lib) : package ‘plyr’ is not available (for R version 2.13.0)

  1. now I made a local lib and tried

    mkdir ~/R_libs
    install.packages("lattice",repos="http://cran.r-project.org", lib="~/R_libs/")
    

then again warning

Warning: unable to access index for repository http://cran.r-project.org/src/contrib Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘lattice’ is not available (for R version 2.13.0)

I downloaded packages, and uploaded into the cluster. is it possible to install from that??

I don't have any sudoers rights(Administrator privileges). cluster is having 32 nodes.

Edit: I uploaded car_2.1-0.zip to the cluster and tried the bellow code.

R CMD INSTALL car_2.1-0.zip -l /R_libs

but I got the response as shown below

Error in rawToChar(block[seq_len(ns)]) : embedded nul in string: 'PK\003\004\n\0\0\0\0\0\xef3ZG\0\0\0\0\0\0\0\0\0\0\0\0\004\0\0\0car/PK\003\004\024\0\002\0\b\0\xe03ZGn\xaa\xf3\x90Q\001\0\0\xa2\002\0\0\f\0\0\0car/CITATION\x9dR\xc1j\0021\020=W\xf0\037\x86=\xed\x82\xec\xd6\036\x85\036\xb6b)E'

Is there any way to overcome this?? Thanks

Upvotes: 0

Views: 6592

Answers (2)

FatihSarigol
FatihSarigol

Reputation: 647

module load R

(say this is the R on the cluster, so now it is on your path and you can enter it by typing R)

export R_LIBS_USER=$HOME/apps/R:$R_LIBS_USER

(you are still on the Linux commandline, not in R yet)

R

(now you enter R)

install.packages("packagename")

Well done, it will install the package to HOME/apps/R

library(packagename)

(Try it and see it worked)

Upvotes: 0

bibinwilson
bibinwilson

Reputation: 358

Thank you so much for providing the details for my question as comment. Let me conclude all those information here.

Instead of begging to your system admin, it's better to follow the following procedure

Step 1: download latest version of R from the following link : https://cran.r-project.org/sources.html(i downloaded R-3.2.2)

Step 2: upload it into your cluster(I'm using WinSCP in windows 8.1)

Step 3: unpack it using the following command tar -xf R-x.y.z.tar.gz

in my case its tar -xf R-3.2.2.tar.gz

Step 4: go to that directory using the code cd R-3.2.2

Step 5: type ./configure or ./configure --enable-R-shlib && make

Step 6: after the completion of config, type make

Step 7: Then check the built system works correctly by make check

Enjoy!!!

Upvotes: 2

Related Questions