Infers the R packages that your R package depends on.
infer_deps(
path = here::here("DESCRIPTION"),
which = c("Imports", "Suggests"),
imports_thresh = 2,
imports = NULL,
suggests = c("testthat", "rmarkdown", "markdown", "knitr", "remotes", "knitr", "covr"),
errors = c("reported", "fatal", "ignored"),
dev = FALSE,
progress = TRUE,
add_newlines = FALSE
)
The path to a .R
, .Rmd
, .qmd
, DESCRIPTION
, a directory
containing such files, or an R function. The default uses all files
found within the current working directory and its children.
Which types of dependencies to return.
The minimum number of times that a package has to be called within your package to assign it as an Import. If is called less times than this threshold, it will instead be assigned as a Suggest, which means it will not be installed by default.
R packages that are exempt from the suggests_thresh
rule and are instead automatically assigned as Imports.
R packages that are exempt from the suggests_thresh
rule and are instead automatically assigned as Suggests.
How should errors that occur during dependency enumeration be handled?
"reported"
(the default): errors are reported to the user, but
otherwise ignored.
"fatal"
: errors are fatal and stop execution.
"ignored"
: errors are ignored and not reported to the user.
Boolean; include development dependencies? These packages are typically required when developing the project, but not when running it (i.e. you want them installed when humans are working on the project but not when computers are deploying it).
Development dependencies include packages listed in the Suggests
field
of a DESCRIPTION
found in the project root, and roxygen2 or devtools if
their use is implied by other project metadata. They also include packages
used in ~/.Rprofile
if config$user.profile()
is TRUE
.
Boolean; report progress output while enumerating dependencies?
Prefix each package name with a newline character and two spaces. This is useful for formatting DESCRIPTION files.
A character vector of R package names.
#### Get example DESCRIPTION file ####
url <- "https://github.com/neurogenomics/templateR/raw/master/DESCRIPTION"
path <- tempfile(fileext = "DESCRIPTION")
utils::download.file(url,path)
deps <- infer_deps(path = path)
#> Finding R package dependencies ... Done!