
Interactive Dependency Diplomat (Base R Edition)
Source:R/audit_dependencies.R
audit_dependencies.RdScans package source code for external package calls and cross-references them against the `DESCRIPTION` file to interactively resolve missing, unused, or misclassified dependencies without requiring any external tools.
Value
Invisibly returns a named list with components: status ("done",
"clean", or "error"), ghost_deps, bloat_deps,
misclassified, and description_modified (logical).
Details
The function implements a zero-dependency approach to dependency auditing:
Parses the `DESCRIPTION` file to identify currently declared `Imports` and `Suggests`.
Recursively scans the `R/`, `tests/`, and `vignettes/` directories for `::` calls, `library()` calls, and `require()` calls.
Filters out base R packages.
Interactively prompts the user to add missing dependencies or remove unused ones from the `DESCRIPTION` file.
Warning
This function modifies files on disk or the global environment. Please ensure you have a backup or are using version control (e.g., Git) before execution.
Examples
if (interactive()) {
audit_dependencies()
}