This function is called by the provided Rd macro \\cite{pkg}{key}:

• Parses the bibtex file references.bib in the root directory of package package using bibtex::read.bib().

• Extracts the entry with key key.

• Converts to Rd with tools::toRd().

cite_bib(package, key)

## Arguments

package (character(1)) Package to read the bibtex file from. (character(1)) Entry of the bibtex file. If the key is "pkg::citation", the citation() information of the package is used instead. If the package provides multiple citation entries, a specific one can be selected by appending "::n" to the string key where n is the number of the citation entry (defaults to the first entry).

## Value

(character(1)) Bibentry formated as Rd.

## Examples

# examplary bibtex file
path = system.file("references.bib", package = "mlr3misc")
cite_bib("stats", "pkg::citation")#> [1] "R Core Team (2019).\n\\emph{R: A Language and Environment for Statistical Computing}.\nR Foundation for Statistical Computing, Vienna, Austria.\n\\url{https://www.R-project.org/}."