I have two rmarkdown documents, I want to be able to pull specific code chunks from document 1 into document 2.
I know you can do this from .r scripts and .rmd if you insert a chunk label in the form of ## ---- label I am wondering if it is possible to do this using the named chunks in document 1.
Currently I am doing this in document one:
``` {r data_read}
## ---- data_read_chunk
penguins <- read.csv("penguins.csv")
```
and this in document 2:
```{r, include=FALSE, cache=FALSE}
knitr::read_chunk(path = "document_1.Rmd")
```
```{r data_read_chunk, eval=FALSE}
```
What I would like to be able to do is be able to use the 'data_read' chunk label like this:
``` {r data_read}
penguins <- read.csv("penguins.csv")
```
and have this in document 2:
```{r, include=FALSE, cache=FALSE}
knitr::read_chunk(path = "document_1.Rmd")
```
```{r data_read, eval=FALSE}
```