rnso
rnso

Reputation: 24623

r install.packages to install downloaded packages

I am trying to install and update packages. install.packages(ask=FALSE) downloads the packages but if there is an error, it aborts. If I run it again, it again downloads the packages. How can it check and install already downloaded packages on repeat running rather than downloading every time?

I am using Debian Stable Linux with backports repository, as mentioned on : http://cran.r-project.org/bin/linux/debian/README

Upvotes: 3

Views: 5585

Answers (2)

Vincent Guyader
Vincent Guyader

Reputation: 3199

you can use the destir parameter and set repos to NULL

install.packages("RcppEigen",destdir = '/tmp/RtmpWq9e8P/downloaded_packages',repos=NULL)

Upvotes: 1

nicola
nicola

Reputation: 24520

This answer is for a linux system, although I think that for windows things shouldn't be different. When you try to install a package, at the end of the process (whether successful or not), R tells you where is the downloaded package. You should see something like this:

    #The downloaded source packages are in
    #       ‘/tmp/RtmpSPFiKl/downloaded_packages’

The path may change on a case basis. R stores the source packages in a temporary folder; this means that next time you reboot, files will disappear. So, suppose that I was trying to install a package that needs some system requirements. I receive an error. Then I proceed to install the needed system packages. When I try to install the R package back, I can:

   install.packages("/tmp/RtmpSPFiKl/downloaded_packages/packagename.tar.gz",repos=NULL)

without having to download it a second time.

Upvotes: 2

Related Questions