Inspects a project directory for the R packages it uses. The detection priority is:
Details
renv.lock(thePackagesmap),DESCRIPTION(Depends,Imports,LinkingTo, and optionallySuggests),.R,.Rmd,.qmd, andNAMESPACEfiles (looking forlibrary(),require(),requireNamespace(), andpkg::funreferences; line comments are ignored).
See also
Other preflight:
check_library(),
check_packages(),
check_project()
Examples
project <- file.path(tempdir(), "demo-project")
dir.create(project, showWarnings = FALSE)
writeLines(
c("Package: demo", "Imports: xml2, curl"),
file.path(project, "DESCRIPTION")
)
detect_project_packages(project)
#> [1] "curl" "xml2"
