The Art of R Programming

(WallPaper) #1
A call to.libPaths()without an argument will show you a list of all the
places R will currently look for loading a package when requested.

B.3.2 Installing Packages Manually....................................


Sometimes you need to install “by hand” to make modifications required to
make a particular R package work on your system. The following example
demonstrates how I did so in one particular instance, and it will serve as a
case study on handling situations in which ordinary methods don’t work.

NOTE Situations in which you need to install packages by hand typically are operating system
dependent and require more computer expertise than is generally assumed in this book.
For help in very specific cases, ther-helpmailing list is invaluable. To access it, go to
the R home page (http://www.r-project.org/), click the FAQs link and then the R
FAQ link, and scroll down to Section 2.9, “What mailing lists exist for R?”

I wanted to install theRmpipackage on our department’s instructional
machines in the directory/home/matloff/R. I tried usinginstall.packages()
first but found that the automated process could not find the MPI library
on our machines. The problem was that R was looking for those files in
/usr/local/lam, whereas I knew they were in/usr/local/LAM. Since these
were public machines, not my own, I did not have the authority to change
the name. So, I downloaded theRmpifiles in the packed formRmpi_0.5-3
.tar.gz. I unpacked that file in my directory~/tmp, producing a directory
named~/tmp/Rmpi.
If I had not experienced this problem, at this point, I could have just
typed the following in a terminal window from within the~/tmpdirectory:

R CMD INSTALL -l /home/matloff/R Rmpi

That command would install the package contained in~/tmp/Rmpi,
placing it in/home/matloff/R. This would have been an alternative to calling
install.packages().
But as noted, I had to deal with a problem. Within the~/tmp/Rmpi
directory, there was aconfigurefile, so I ran this command on my Linux
command line:

configure --help

It told me that I could specify the location of my MPI files toconfigure,
as follows:

configure --with-mpi=/usr/local/LAM

This applies if you runconfiguredirectly, but I ran it via R:

R CMD INSTALL -l /home/matloff/R Rmpi --configure-args=--with-mpi=/usr/local/LAM


Installing and Using Packages 357
Free download pdf