1

I'm working on Windows with R 3.6.3 which is the latest version my employer will allow me to install. They also have a firewall that effectively blocks access to the CRAN.

I used the miniCRAN package to create a small repository of packages I want and their dependencies. I constructed it from an older snapshot of the CRAN given my old version

library(miniCRAN)

mirror <- c(CRAN = "https://packagemanager.rstudio.com/cran/2020-03-02")  #old CRAN compatible with our R version

pkgs <- c("tidytext", "tidyr", "lexicon")    #etc for a long list of packages
pkgList <- pkgDep(pkgs, repos = mirror, type = "source", suggests = FALSE)

dir.create(pth <- file.path(tempdir(), "miniCRAN"))

makeRepo(pkgList, path = pth, repos = mirror, type = c("source", "win.binary"))

After running that I then had a directory called miniCRAN with subdirectories bin and src. The src/contrib folder that was created contains only tar.gz files.

I burned the miniCRAN directory to disc and then dropped it on a shared drive on our offline network. At the console in R Studio I then ran

tools::write_PACKAGES("file://c:/<path>/miniCRAN/src/contrib", type="source")

This creates a PACKAGES and a PACKAGES.gz file in the directory

However, when I try to install a package from this repository

install.packages("ggplot2", repos="file://c:/<path>/miniCRAN")

I get an error message

cannot open compressed file '//C:/Users/1129002260C/Documents/miniCRAN/src/contrib/PACKAGES', probable reason 'Invalid argument'

Can anyone point out what I'm doing wrong here?

jerH
  • 1,085
  • 1
  • 12
  • 30
  • Are these `` variables just placeholders, or you're actually running that on your console? Also why use `file://` and not `file:/`? – Harshvardhan Jun 29 '23 at 00:09
  • They are just placeholders....the way they set up our accounts the name of my employer is in the path, so I just figured I'd play it safe. As for `file://` it was taken from an answer to [this](https://stackoverflow.com/questions/2905650/creating-a-local-r-package-repository) question – jerH Jun 29 '23 at 01:08

0 Answers0