In this short unit, you will learn how to manage your references within the R/Quarto/Markdown stack of tools.

Learning Objectives

  • Know how to do reference management that plays nicely with Quarto/Markdown

Reference management with Quarto/R Markdown

For almost any data analysis, especially if it is meant for publication in the academic literature, you will have to cite other people’s work and include the references in your work. In this class, possibly for some of our exercises and definitely for the class project, you need to include references and cite other people’s work like in a regular research paper.

I assume you are familiar with how citing references works, and hopefully, you are already using a reference manager. You might be using EndNote or Mendeley or PaperPile or…

To have something that plays well with Quarto/R Markdown, you need references in a format called bibtex. This is essentially a large file of structured plain text. You don’t ever want to edit the bibtex file yourself. Instead, you use a reference manager that is bibtex friendly. I mostly use Zotero, which is free. If you use Zotero, you should use the Better BibTeX extension, which allows you to keep your bib file in sync as you update references in Zotero.

You could probably use others. I don’t have much experience with any others. Whichever reference manager you use, the important part is that you need to be able to save or export your references as a bibtex file.

To use references in your Quarto or RMarkdown files, specify the name and location of your bibtex file in the YAML header. You can also specify a CSL style file there. This is a file which controls how the references are formatted. Styles for almost any journal are available for download here. When you create your bibtex file, each reference gets a key, which is a shorthand that is generated by the reference manager or you can create yourself. For instance, I use a format of lower-case first author last name followed by 2 digit year for each reference. If I cite a paper by the same first author that was published in the same year, then a lower case letter is added to the end. For instance, for a paper that I wrote as 1st author in 2010, my bibtex key might be handel10 or handel10a. You can decide what scheme to use, just pick one and use it forever.

In your Quarto document, you can then cite the reference by adding the key, such as ...in the paper by Handel et al. [@handel10].... When you process the file, it looks for a reference with the specified tag in your bibtex file and places all references at the end of your document using the formatting you specified.

For references with Quarto, see here.

Some more details on citations and references in R Markdown/bookdown can be found here and here.

You will see a few examples of bibtex use together with Quarto/R Markdown in the course, so when it’s time for you to use it (e.g. for the class project), you should know how to go about doing it.