rnso rnso - 1 month ago 4x
R Question

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


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:


without having to download it a second time.