Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active July 15, 2019 18:46
Show Gist options
  • Save mikelove/87c7e222870e2b41e3986d2065018992 to your computer and use it in GitHub Desktop.
Save mikelove/87c7e222870e2b41e3986d2065018992 to your computer and use it in GitHub Desktop.
Get the missing packages from Suggests from R package DESCRIPTION
get_deps <- function(what="Suggests") {
deps <- desc::desc_get_deps()
suggests <- deps$package[deps$type==what]
setdiff(suggests, sub(".*/","",find.package(suggests, quiet=TRUE)))
}
@mikelove
Copy link
Author

This function is useful if you want to work on a package but you need to install it's Suggests packages to build the vignette.

You first need the desc package to run the function. You can install it with install.packages("desc").

The idiom is:

get_deps() # to see what is missing
BiocManager::install(get_deps()) # to install missing deps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment