Installing package from a local zip file in R

20,037

Try :

install.packages(file.choose(), repos = NULL, type="source")

It will allow you to select the desired zip file.

Share:
20,037
Agnieszka Walczak
Author by

Agnieszka Walczak

Updated on February 24, 2020

Comments

  • Agnieszka Walczak
    Agnieszka Walczak about 4 years

    I am trying to install a package in R from a local zip file. I have the zip file on a local drive, but when I go to Packages --> Install a package from a local zip file I get the following warning:

    > utils:::menuInstallLocal()
    Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open the connection
    

    In addition: Warning messages:

    1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
    2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open compressed file 'cirt/DESCRIPTION', probable reason 'No such file or directory'
    

    What is going on here?

    Many thanks in advance, A

  • Agnieszka Walczak
    Agnieszka Walczak almost 8 years
    Thank you! But now I get the following message:Installing package into ‘C:/Users/walcza/Documents/R/win-library/3.2’ (as ‘lib’ is unspecified) Error in untar2(tarfile, files, list, exdir, restore_times) : incomplete block on file Warning messages: 1: running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\walcza\Documents\R\win-library\3.2" "C:/Windows/System32/cirt/R/cirt"' had status 1 2: In install.packages(file.choose("cirt"), repos = NULL, type = "source") : installation of package ‘C:/Windows/System32/cirt/R/cirt’ had non-zero exit status >
  • George Dontas
    George Dontas almost 8 years
    See this related answer. stackoverflow.com/a/34712100/170792
  • smci
    smci about 7 years
    Actually, type = "source" or "binary", depending on what the zip is. ("binary" selects automatically from "mac.binary"/ "mac.binary.mavericks"/ "win.binary")