Learn R Programming

mlr3misc (version 0.1.5)

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.

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")

# return value: raw rd
cite_bib("mlr3misc", "mlr")
# }

Run the code above in your browser using DataLab