Install R packages outside R

Viewed 410

So the thing is my IT department is scared of R and therefore only allows us to use it on a laptop that can't go online. Therefore they are the ones to install packages on it.

But due to covid I'm at home discovering they didn't install the requested packages. So I'm looking to see if there is a way to download these packages on a laptop with internet access, add them to an USB and then install them from the USB in R?

1 Answers

Quite easy, just download the package from the CRAN site e.g. https://cran.r-project.org/web/packages/imputeTS/

You can either download the "Package source" or the "Binaries" (must be your operating system.

If you are using R Studio, there is then even a menu item for installing the package - just select the file you downloaded and here you go. enter image description here

If you are not using R Studio, just provide the path to your downloaded archive in the install.packages command.

The only problem is, you also need all the dependencies ...;) So you ideally already have them and just one package is somehow missing - otherwise this can get quite time consuming to download all the dependencies - because the dependencies itself also usually have dependencies themselves...

In this case the miniCRAN solution Roland linked in the comments might be an idea. ( Offline installation of a list of packages: getting dependencies in order ) But didn't try the miniCRAN myself yet - would be interested how good this actually works.

Related