sebastian-c
sebastian-c

Reputation: 15395

Installing packages into a library ignoring other libraries

I currently have testthat installed on my machine. I want to install the package and all its dependencies (recursively) into a separate library. The problem is that when I try to do this using install.packages("testthat", lib = "newdir"), its dependencies, such as xml2 are not installed along with it. How can I install a package and all its dependencies into a new library?

Upvotes: 1

Views: 263

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368181

I would do the following:

  • use install2.r from littler with its -l argument for the target library (and I do things like this all the time for reverse dependency checks

  • maybe use a properly set/reset .libPaths() so that the current installation you are doing does not "see" the existing installations; worst case you make a copy of install2.r and set/reset .libPaths() there; you may need to experiment with Rscript vs r to launch it as r gets some values "baked in" during its compilation

Taken together it is basically what we do when we keep a separate R-devel on a box as well.

Edit: You can of course script this with install2.r -- it is just a wrapper to install.packages(). But it happens to be setting the relevant arguments.

Upvotes: 1

Related Questions