2.13 Creating a bibliography
For R Markdown to incorporate the bibliography into the document, a bibliography file (in the biblatex format) needs to be specified in the YAML. Optionally, a csl file can also be specified. Note that if no filepath is specified, then the directory of the .Rmd file is used. In this example, bibfile.bib is in the local directory, but the csl is stored in a central location.
bibliography: bibfile.bib
csl: ../../../csl/Vancouver.csl
Note:: This function has been removed as of August 2021, but will be incorporated into the reportRx extension package in the autumn of 2021.
There is now a reportRx function,
rmdBibfile
that will read through an R Markdown document and extract all the references from a master bibfile and write them to a local file along with and all the R packages referenced in the document.reportRx::rmdBibfile('../library.bib','bibfile.bib')
will use the file library.bib in the parent directory to extract references from and write a smaller bib file in the local directory stored as bibfile.bib with all the references in the current document, including R packages. The master bibfile can be the .bib file produced by programs like Mendeley or Zotero.