Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 318
nathaneastwood Avatar asked Jan 08 '17 12:01

nathaneastwood


1 Answers

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

like image 64
nathaneastwood Avatar answered Nov 11 '22 12:11

nathaneastwood