R Language Bibliography in RMD Specifying a bibliography and cite authors


Example

The most important part of your RMD file is the YAML header. For writing an academic paper, I suggest to use PDF output, numbered sections and a table of content (toc).

---
title: "Writing an academic paper in R"
author: "Author"
date: "Date"
output:
  pdf_document:
    number_sections: yes
toc: yes
bibliography: bibliography.bib
---

In this example, our file bibliography.bib looks like this:

@ARTICLE{Meyer2000,  
  AUTHOR="Bernd Meyer",  
  TITLE="A constraint-based framework for diagrammatic reasoning",  
  JOURNAL="Applied Artificial Intelligence",  
  VOLUME= "14",  
  ISSUE = "4",  
  PAGES= "327--344",  
  YEAR=2000  
}

To cite an author mentioned in your .bib file write @ and the bibkey, e.g. Meyer2000.

# Introduction

`@Meyer2000` results in @Meyer2000.

`@Meyer2000 [p. 328]` results in @Meyer2000 [p. 328]

`[@Meyer2000]` results in [@Meyer2000]

`[-@Meyer2000]` results in [-@Meyer2000]

# Summary

# References

Rendering the RMD file via RStudio (Ctrl+Shift+K) or via console rmarkdown::render("<path-to-your-RMD-file">) results in the following output:

enter image description here