4
votes

I am searching for a way to produce a standalone HTML document from a chunk in Rmarkdown.

My example is this:
I have an Rmarkdown document for my analysis.
In one chunk of code, I produce interactive plotly plots that are quit long to load when I open the HTML.
I am looking for an option that would create another HTML document for this particular chunk and put a link to it in its place in the master HTML document.

I am sure I could manage to do something like that with a bit of tweaking with another script, but I would like to know if there is not a simpler option first.

Thanks

1
Couldn't you just take the chunk and have it be it's own RMD file and just call the RMD file inside the master Rmarkdown file?Daniel Jachetta

1 Answers

1
votes

Yes, you can nest documents using knitr child documents. Put the chunk you want to isolate in its own Rmd (say, child.Rmd), then use this syntax to insert it in the master document:

```{r child='child.Rmd'}
```