Skip to content

Instantly share code, notes, and snippets.

@Pakillo
Last active December 29, 2020 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pakillo/e1407cc0632a9202813ec2aee2434cc3 to your computer and use it in GitHub Desktop.
Save Pakillo/e1407cc0632a9202813ec2aee2434cc3 to your computer and use it in GitHub Desktop.
Having separate reference lists in a Rmarkdown document

Having separate reference lists in an Rmarkdown document

F. Rodriguez-Sanchez

cite something (Bates et al. 2015)

Main bibliography

Bates, Douglas, Martin Mächler, Ben Bolker, and Steve Walker. 2015. “Fitting Linear Mixed-Effects Models Using lme4.” Journal of Statistical Software 67 (1): 1–48. https://doi.org/10.18637/jss.v067.i01.

Here starts the supplement

cite something else (Wickham 2016)

also cite lme4 (Bates et al. 2015)

Supplementary bibliography

Bates, Douglas, Martin Mächler, Ben Bolker, and Steve Walker. 2015. “Fitting Linear Mixed-Effects Models Using lme4.” Journal of Statistical Software 67 (1): 1–48. https://doi.org/10.18637/jss.v067.i01.

Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. https://ggplot2.tidyverse.org.

---
title: "Having separate reference lists in an Rmarkdown document"
author: "F. Rodriguez-Sanchez"
output:
github_document:
pandoc_args: --lua-filter=multiple-bibliographies.lua
bibliography_main: main.bib
bibliography_suppl: suppl.bib
---
```{r echo=FALSE}
library("knitcitations")
cleanbib()
cite_options(citation_format = "pandoc")
```
cite something `r citep(citation("lme4"))`
```{r include=FALSE}
write.bibtex(file = "main.bib")
```
## Main bibliography
::: {#refs_main}
:::
## Here starts the supplement
```{r echo=FALSE}
cleanbib()
```
cite something else `r citep(citation("ggplot2"))`
also cite lme4 `r citep(citation("lme4"))`
```{r include=FALSE}
write.bibtex(file = "suppl.bib")
```
## Supplementary bibliography
::: {#refs_suppl}
:::
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment