5 How to cite
Properly citing scientific literature is crucial for good research. You should always acknowledge the work of other researchers from which you took inspiration, cite the orinigal litureature where your that describes the data you used, and provide a context citing relevant scientific literature. Here, we will shortly explain how you can compile a bibliography, directly from RStudio, and cite all the relevant papers and datasets in your report.
All papers, books, datasets, code bases, etc. have an associated Digital Object Identifier (DOI). You can use it to search for publications online, but also to easily add citations to your project report - and future research output.
5.1 Adding citations in RStudio
While you edit your report.Rmd
file on RStudio, you can choose to work on the Source or Visual editors for RMarkdown files. The first allows to see the raw text/code, while the second already shows a rough preview of the rendered output from your markdown code.
It’s very easy to properly add citations from the Visual editor. You just need to click on Insert > @ Citation to open the RStudio dialogue to create a citation.
Next, click on From DOI and paste the DOI associated with the paper, book or dataset you want to cite. When you click Insert, a file references.bib
is created in your R Project’s root directly. The references.bib
file contains all the citations in your project, saved in BibTeX format. Every new citation that you create is added to the references.bib
file with a tag that identifies it; here it’s @weedon2014
.
You can use these citation tags to add citations to your report. Writing @weedon2014
will produce the following inline citation Weedon et al. (2014) and writing [@weedon2014]
will produce the in-parenthesis version (Weedon et al. 2014).