0

I am working in a computer without admin rights. The R version installed is 3.4.4. The IT administrator sees no prospect in upgrading R.

I need to install a package and its dependencies manually (I know how to do this). To download the packages and dependencies, I use the code below (borrowed from here), which works fine:

getPackages <- function(packs){
  packages <- unlist(
    tools::package_dependencies(packs, available.packages(), which=c("Depends", "Imports"), recursive=TRUE)
  )
  packages <- union(packs, packages)
  packages
}

packages <- getPackages(c("gmm"))

download.packages(packages, destdir="/home/<user>/Downloads/", type="win.binary")

The only problem is that it will download the latest version of every package. Is there a way I can do the above, but specifying an R version? The package_dependencies() function seems to contain not such option. There is a package called miniCRAN (here) which has functions to check dependencies accepting the option of Rversion, but only allowing for two digits (e.g. 3.1, 3.2, etc). I need the three digit one.

luchonacho
  • 6,759
  • 4
  • 35
  • 52
  • Is there a package where a three digit version number match is required? What's wrong with minicran when you use version 3.4? – MrFlick Sep 19 '18 at 13:02

1 Answers1

0

You can first see which is the suitable version of the package for your R and then using:

install_version("gmm", version = "0.x.x", repos = "http://cran.us.r-project.org")
  • Sure, but this involves the manual task of going to the website of every package I want. I'm looking for an automatic way to do this. The information must somewhat be built-in somewhere. – luchonacho Sep 19 '18 at 10:15
  • Hi luchonacho, I don't think there is an automatic way to do this. Here was described an heuristic solution [https://stackoverflow.com/questions/35890269/how-to-only-install-versions-of-packages-that-were-made-under-a-specific-r-relea], it might help – SigmaTilde Sep 19 '18 at 13:01