Creates a .bib
-reference file for the installed R version and R-packages,
so they can be cited in an R Markdown-document.
r_refs(
file,
append = TRUE,
prefix = "R-",
type_pref = c("Article", "Book"),
tweak = TRUE
)create_bib(
x,
file,
append = TRUE,
prefix = "R-",
type_pref = c("Article", "Book"),
tweak = TRUE
)
Invisibly returns the bibliography written to file
.
Character. Path and name of the file to be created or updated.
Logical. Indicates if existing bibliography should be complemented or overwritten. See details.
Character. Prefix for all R-package reference handles.
Character. A vector of BibTeX entry types in the order by
which to prioritize packages CITATION
entries. See details.
Logical. Indicates whether to fix some known problems in
citations (based on write_bib
).
Character. Names of packages to include in bibliography.
r_refs
is a wrapper for create_bib
to create a
bibliography for R and all attached or cached packages.
By default, if a file exists at the specified location, r_refs
reads the
file and appends missing citation information to the end of the file
(create_bib
always overwrites existing files). It is
recommended to use a bibliography-file dedicated to R-references.
Beware that chunks loading packages should generally not be cached.
r_refs
will make all packages loaded in cached chunks citable, but it
won't know when you remove a package from a cached chunk. This can result
in unused package references in your bibliography-file that will be cited
when using cite_r
.
If a package provides citation information in a CITATION
file, a
reference is selected based on the preferred order of reference types
specified in type_pref
. By default, available articles are cited rather
than books. If no reference of the specified types is available, the first
reference is used. If multiple references of the preferred type are given
all of them are cited. Finally, if no CITATION
file exists a reference
is generated from the DESCRIPTION
file by citation
.
cite_r()
, knitr::write_bib()
, utils::citation()
, utils::toLatex()