This function scans the project for R packages used, saves a BibTeX file with package references, and returns a data frame with package names, version, and citation keys.
get_pkgs_info(
pkgs = "All",
out.dir = NULL,
omit = c("grateful"),
cite.tidyverse = TRUE,
dependencies = FALSE,
bib.file = "grateful-refs",
include.RStudio = FALSE,
...
)A data.frame with package info, and a file containing package references in BibTeX format.
Character. Either "All" to include all packages used in scripts
within the project/folder (the default), or "Session" to include only packages
used in the current session.
Alternatively, pkgs can also be a character vector of package names to
get citations for. To cite R as well as the given packages,
include "base" in pkgs (see examples).
Directory to save the BibTeX file with references.
It is recommended to set out.dir = getwd().
Character vector of package names to be omitted from the citation
report. grateful is omitted by default. Use omit = NULL to include all
packages.
Logical. If TRUE, all tidyverse packages
(dplyr, ggplot2, etc) will be collapsed into a single citation
of the 'tidyverse', as recommended by the tidyverse team.
Logical. Include the dependencies of your used packages?
If TRUE, will include all the packages that your used packages depend on.
Desired name for the BibTeX file containing packages references ("grateful-refs" by default).
Logical. If TRUE, adds a citation for the
current version of RStudio.
Other parameters passed to renv::dependencies().
if (FALSE) { # interactive()
get_pkgs_info(out.dir = tempdir())
get_pkgs_info(pkgs = c("renv", "remotes"), out.dir = tempdir())
}
Run the code above in your browser using DataLab