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?