Reference Management in RMarkdown

Photo by Thomas Kelley on Unsplash

Background And Overview

  • There are a variety of software one can use to generate manuscripts. RMarkdown has certain advantages such as the ability to write in-line code and incorporate real-time data visualizations
  • There are also numerous programs available to assist with managing references and citations, including, but not limited to EndNote, Reference Manager, and Mendeley
  • We’ve incorporated EndNote into our lab’s workflow; thus the objective of this tutorial is to provide instructions on how to integrate an EndNote library into RMarkdown documents
  • There are several good references that already exist that discuss bibliographies in RMarkdown (e.g.
  • However, in this post, we list step-by-step instructions of one method that we’ve had success with that we believe add to the currently available resources because of the granularity of the detail we provide
    • Hopefuly these extra details facilite your implementation of these two powerful software programs into your workflow
STEP 1 - Open EndNote
  • Open your EndNote library of interest

STEP 2 - Select Pertinent References
  • Select the references you wish to include (of note, here we are going to use all the references, so we just selected “all”)

STEP 3 - Export References
  • Now we are going to export these references
  • File -> Export

  • When the dialogue box opens (as below) go to the Output Style and Select BibTeX Export
    • BibTex is not the only format that will work, but we are going to use the BibTex file format, becuase it is fairly straightforward and we’ve had good success with it
  • Select the folder that you are going to be saving your RMarkdown in
    • Here we are using the “References_R_Markdown” folder that we created
  • Save the file as bibliography as a text only file with the extension .txt

STEP 4 - Change the File Extension
  • Now go and change the file extension from .txt to .bibtex

STEP 5 - Find the Citation Key of Interest
  • First view the bibliography.bibtex file by clicking on the file name in the Files box on the lower right in your RStudio IDE

  • Next, you need to identify the citation key for the reference you wish to insert

  • Here we are interested in entering the citation for the Shalhout et al. 2020 JAAD article

    • Thus, we used the search tool and found the citation fairly rapidly
  • You’ll see that the citation starts with a @article followed by a curly bracket

    • Immediately following the curley bracket is an alphanumeric code (here @RN2687).

       author = {Shalhout, S. Z. and Bloom, R. and Drake, L. and Miller, D. M.},
       title = {Evaluation of the fragility of pivotal trials used to support US Food and Drug Administration approval for plaque psoriasis},
       journal = {J Am Acad Dermatol},
       ISSN = {1097-6787 (Electronic)
       0190-9622 (Linking)},
       DOI = {10.1016/j.jaad.2020.04.057},
       url = {},
       year = {2020},
       type = {Journal Article}} 
  • The @RN2687 is the citation key

  • You will use this information in your RMarkdown as your citation.

  • Seen the context of the IDE:

STEP 6 - Format the YAML
  • Next, you need to format your YAML to let RMarkdown know which format your bibliography is in
    • Since we exported our EndNote using BibTex style we will use the suffix .bibtex as follows:

Citation Style

  • pandoc uses a Chicago author-date by default

  • If you desire another style, you can specify a CSL 1.0 style in the YAML, as seen here:

       title: "Sample Document" 
       output: html_document   
       bibliography: bibliography.bibtex  
       link-citations: yes
STEP 8 - Insert Citation of Interest
  • Now we can enter our citation by placing the citation key (here @RN2687) within square brackets in the desired location in your text

STEP 9 - Add References
  • References will be placed at the end of your document, so make the last test in your RMarkdown # References

STEP 10 - Knit Your Document
  • Lastly, knit your document and you should see your desired references

Take Home Points

  • Coupling RMarkdown with a reference managing software is a great way to maximize your manuscript-generating efficiency

As always, please reach out to us with thoughts and feedback

David Michael Miller
Medical Oncologist and Dermatologist

My research interests include clinical and translational research in advanced skin cancers.