I’m attempting to install packages from my miniCRAN repository that I created with R 3.6.3 on a Windows system. The repository contains only tar.gz files, and I placed it on an offline network drive. However, when I attempted to install a package, I received an error message.
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"))
Burn the miniCRAN directory to disc and drop it on a shared drive on your offline network. At the console in R Studio, run:
tools::write_PACKAGES("file://c:/<path>/miniCRAN/src/contrib", type="source")
This creates a PACKAGES
and a PACKAGES.gz
file in the directory.
To install a package from the repository, run:
install.packages("ggplot2", repos="file://c:/<path>/miniCRAN")
If an error message appears, such as:
cannot open compressed file '//C:/Users/1129002260C/Documents/miniCRAN/src/contrib/PACKAGES', probable reason 'Invalid argument'
Please provide details of the issue.