nathaneastwood
nathaneastwood

Reputation: 3764

Include Rmd appendix after references

My question is linked to this one. I wish to include my appendix after my references so I am using the after_body tag in my yaml, however I need to be able to knit my appendix.Rmd file. I have tried the following:

after_body: "`r knitr::knit('appendix.Rmd')`"

however this attempts to knit the appendix.Rmd file before the actual report and therefore fails as it does not have the required libraries or objects in memory.

Upvotes: 14

Views: 4137

Answers (1)

nathaneastwood
nathaneastwood

Reputation: 3764

In order to have appendices after the references, you simply include a div with id="refs" which tells pandoc where to include the references section. For example:

```{r, child = "08_discussion.Rmd"}
```

# References

<div id="refs"></div>

```{r, child = "09_appendix.Rmd"}
```

Credit: https://twitter.com/tjmahr/status/763435602935095296

Upvotes: 27

Related Questions