1

I am using blogdown to create content for the web. Often, I need to include some chunk of content coming from an .Rmd snipped (markdown + R computation).

Context

For example, I have this common content in common.Rmd:

The **correlation** between the terms of topic `A` and topic `B` is as follows:

    ```{r}
    kendall.tau(x,y)
    ```

Some more text here...

And then I have file content1.Rmd:

The two data sets are similar to topic `A` and `B`:

<reference 'common.Rmd' here>

Bla bla...

Question

How do I include .Rmd files so that their output is placed exactly where I want in another .Rmd file?

Andry
  • 16,172
  • 27
  • 138
  • 246
  • 2
    Have you tried child? https://stackoverflow.com/questions/36558273/is-there-a-way-to-include-child-rmd-files-from-a-different-directory – pogibas Apr 07 '19 at 09:24
  • Seems very related, I am trying it thanks – Andry Apr 07 '19 at 09:45
  • @PoGibas: Please post it as an answer, it worked :) – Andry Apr 07 '19 at 09:52
  • I wrote a function `source_rmd_chunks()` https://gist.github.com/brshallo/e963b9dca5e4e1ab12ec6348b135362e that handles just the R content part (though not the markdown stuff). – Bryan Shalloway Aug 17 '21 at 22:02

0 Answers0