| Type: | Package |
| Title: | Identify External Packages Used in a Project |
| Version: | 0.4 |
| Description: | Screens all '.R', '.Rmd', and '.qmd' files to extract the name of packages used in a project. This package detects packages called with 'library(foo)', 'require(foo)', 'foo::bar()' and 'use("foo", "bar")' and adds these dependencies in the DESCRIPTION file in the sections Depends, Imports, and Suggests. |
| URL: | https://github.com/frbcesab/rdeps |
| BugReports: | https://github.com/frbcesab/rdeps/issues |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Imports: | cli, utils |
| NeedsCompilation: | no |
| Packaged: | 2025-10-02 14:56:25 UTC; nicolas |
| Author: | Nicolas Casajus |
| Maintainer: | Nicolas Casajus <nicolas.casajus@fondationbiodiversite.fr> |
| Repository: | CRAN |
| Date/Publication: | 2025-10-02 15:10:02 UTC |
rdeps: Identify External Packages Used in a Project
Description
Screens all '.R', '.Rmd', and '.qmd' files to extract the name of packages used in a project. This package detects packages called with 'library(foo)', 'require(foo)', 'foo::bar()' and 'use("foo", "bar")' and adds these dependencies in the DESCRIPTION file in the sections Depends, Imports, and Suggests.
Author(s)
Maintainer: Nicolas Casajus nicolas.casajus@fondationbiodiversite.fr (ORCID) [copyright holder]
See Also
Useful links:
Add required dependencies to the description file
Description
This function detects external packages used in an R project (package,
compendium, website, etc.) and updates the sections Depends,
Imports, and Suggests of the DESCRIPTION file.
A DESCRIPTION file can be created and added to an existing project with
the function use_description() of the package usethis.
All .R, .Rmd, and .qmd files are screened to identify packages
called by library(foo), library("foo"), library('foo'),
require(foo), require("foo"), require('foo'), foo::bar() or
use("foo", "bar").
Different types of dependencies are handled with the following rules:
if a package is called with
library(foo)orrequire(foo), it will be added to the section Depends of theDESCRIPTIONfile (except for vignettes and tests);if the package is called with
foo::bar()oruse("foo", "bar"), it will be added to the section Imports of theDESCRIPTIONfile (except for vignettes and tests);if the package is only used in vignettes or tests, it will be added to the section Suggests of the
DESCRIPTIONfile.
This function also screens the NAMESPACE file (it detects packages
mentioned as import(foo) and importFrom(foo,bar)) and @examples
sections of roxygen2 headers. The detected packages are added in the
Imports section of the DESCRIPTION file.
If the project is not an R package, non-standard folders are also screened
(i.e. analyses/, paper/, etc.). The detected packages are added in the
Imports section of the DESCRIPTION file.
Usage
add_deps()
Value
No return value.
Examples
## Not run:
add_deps()
## End(Not run)
Add to the .rdepsignore file
Description
This function adds files/folders to the .rdepsignore file. The
.rdepsignore file is used by rdeps to ignore files or folders when
detecting dependencies. This plain text file contains a list of files/folders
to be ignored.
This file will be created if it does not exist and will be added to the
.Rbuildignore file.
Usage
add_to_rdepsignore(x)
Arguments
x |
A |
Value
No return value.
Examples
## Not run:
add_to_rdepsignore("analyses/misc")
add_to_rdepsignore("analyses/old_scripts.R")
## End(Not run)