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?
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.
In the command line:
R CMD INSTALL <package-name>.tar.gz
Or in R:
install.packages(<pathtopackage>, repos = NULL, type="source")
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With