Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing package from a local .tar.gz file on Linux [duplicate]

Tags:

r

I would like to install the plyr package from a .tar.gz file, into my library of R packages on a linux machine. How would I go about doing this? Do I just place it in the library directory? What if I do not have write permissions?

like image 727
kimmyjo221 Avatar asked Dec 18 '12 20:12

kimmyjo221


People also ask

How do I install R packages locally?

First, we'll need to create a directory in the home directory, then set a variable to point R at that directory, and then install the package. and you're done. You can pick any directory to make your personal R library.


2 Answers

In the command line:

R CMD INSTALL <package-name>.tar.gz

Or in R:

install.packages(<pathtopackage>, repos = NULL, type="source")
like image 58
EDi Avatar answered Oct 15 '22 01:10

EDi


From the command line,

R CMD INSTALL plyr_x.y.z.tar.gz

If you don't have permission to write to the standard library directory and can't use sudo to override, you can install it somewhere else via

R CMD INSTALL -l <user_lib> plyr_x.y.z.tar.gz

where <user_lib> is a directory you can write to. You may need to specify lib.loc when subsequently loading the package, if <user_lib> is not in .libPaths (see @DWin's answer).

See http://cran.r-project.org/doc/manuals/R-admin.html for more information; R CMD INSTALL --help may also be useful, albeit terse.

like image 11
Ben Bolker Avatar answered Oct 15 '22 00:10

Ben Bolker