mlr3misc (version 0.1.6)

cite_bib: Cite using a Bibtex File

Description

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().

Usage

cite_bib(package, key)

Arguments

package

(character(1)) Package to read the bibtex file from.

key

(character(1)) Entry of the bibtex file. If the key is "pkg::citation", the citation() information of the package is used instead.

Value

(character(1)) Bibentry formated as Rd.

Examples

Run this code
# NOT RUN {
# examplary bibtex file
path = system.file("references.bib", package = "mlr3misc")
cat(readLines(path), sep = "\n")

# bibtex entry as raw Rd
cite_bib("mlr3misc", "mlr")

# citation info as raw Rd
cite_bib("stats", "pkg::citation")
# }

Run the code above in your browser using DataCamp Workspace