Search code examples
rdevtoolstestthat

Install all packages used in testing suite in R?


I'm trying to submit a PR to library(broom) which relies on testing a bunch of different libraries. Is there a quick way to install all the packages used in the testing suite?


Solution

  • We can specify specific dependencies we need to install as follows(You can specify only Suggests for instance:

    install.packages("broom", dependencies = c("Suggests","Enhances",
                                               "Depends"))
    

    More information on available options can be found in the help page of install.packages. For this question, the relevant information is:

    dependencies logical indicating whether to also install uninstalled packages which these packages depend on/link to/import/suggest (and so on recursively). Not used if repos = NULL. Can also be a character vector, a subset of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances").

    Only supported if lib is of length one (or missing), so it is unambiguous where to install the dependent packages. If this is not the case it is ignored, with a warning.