Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Offline installation of packages in RStudio

Tags:

r

rstudio

I am working on a terminal at work that has no http||https connection due to security protocol. I downloaded manually a few packages on another computer and am trying to install them using RStudio. When I do run in RStudio

install.packages(//filedir/package_file.zip,repos=NULL,type="source")

it is trying to connect to an online repository anyways:

>>warning in istall.packages:
>>unable to resolve 'www.stats.ox.ac.uk'

but when I go through RGui and use utils:::menuInstallLocal() and use the popup window it doesn't try connecting through a server and installs my local files.

What am I doing wrong in RStudio?

I also want to be able to make it that the dependencies and imports install automatically for the parent package when I install it.

like image 545
yonicd Avatar asked Mar 09 '14 06:03

yonicd


People also ask

Can you install R packages offline?

To install these packages offline, you can download a compressed file that matches your operating system from ; copy the file to your offline machine. In some cases you'll have to download the dependencies packages as well; if this is required, it will be noted under your package link.

How do I manually install a package in R?

Go into R, click on Packages (at the top of the R console), then click on "Install package(s) from local zip files", then find the zip file with arm from wherever you just saved it. Do the same thing to install each of the other packages you want to install.

How do I install local packages in R?

Local Installation of R Packages To install a R package locally, specify the local directory where you want to install by using the “-l” option in the “R CMD INSTALL” command. For example, to install the R package in the local directory “/usr/me/localR/library”, use the “R CMD INSTALL” as follows.


2 Answers

Assuming you have your packages in zip archive format local onto your machine.

RStudio has a simple menu option

Tools>Install Packages > Select "Package Archive File" in Install from option

browse your package file you need to install.

Post installation you may like to load the libraries for instance if you have installed "tm" package then you may run the command

library(tm) # load the library "tm"

Hope it works :)

like image 66
zyduss Avatar answered Nov 03 '22 01:11

zyduss


Do not use the argument type="source", since you give a link to a zip file:

This should work

install.packages("yourlink.zip", repos=NULL)
like image 20
Pop Avatar answered Nov 03 '22 02:11

Pop