Citations in R Markdown

Here is the main reference you should use to understand citations at R Studio: “Bibliographies and Citations”.

R Markdown uses a source file with the extension .bib (for bibtex in ). You need to name that file in the header of your R Markdown document (i.e. at the top in between the dashed lines): for examples, this file has the lines bibliography: bibliography.bib in the header. You can download the bibliography file for this document here: bibliography.bib.

Each reference will have a “tag” using an at symbol @, for example, for the reference to Sutter below I use the tag @sutter09. In most instances, you can grab the bibliographic information from the website for the article (I’ll show you how with the AEA journals).

Here are a couple of examples.

These will automatically then populate the paper at the end of the R Markdown exported file. So I have a section ## References as my last section and it’ll auto-populate with those references I’ve cited in my bibliography file.

Other stuff

You ought to cite the R Packages that you use. To find the citation for an R package call on citation("packagename") and it will output the citation in the console. You should copy/paste the output into your bibliography file and add a tag to it.

References

Hlavac, Marek. 2015. Stargazer: Well-Formatted Regression and Summary Statistics Tables. https://CRAN.R-project.org/package=stargazer.

Malmendier, Ulrike, and Klaus M. Schmidt. 2017. “You Owe Me.” American Economic Review 107 (2): 493–526. doi:10.1257/aer.20140890.

Sutter, Matthias. 2009. “Individual Behavior and Group Membership: Comment.” American Economic Review 99 (5): 2247–57. doi:10.1257/aer.99.5.2247.

Wickham, Hadley. 2017. Tidyverse: Easily Install and Load ’Tidyverse’ Packages. https://CRAN.R-project.org/package=tidyverse.