Conditionally include a list of child documents in RMarkdown with knitr

后端 未结 2 845
[愿得一人]
[愿得一人] 2021-02-08 11:33

Given a list of child documents, how can you choose which to insert into a master document based on some criteria?

In my use case, I am matching the unknown entries in o

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-08 12:23

    Found the solution myself; simply pass a vector of child documents to the code chunk.

    ```{r}
    child_docs <- c("doc1.Rmd", "doc2.Rmd","doc3.Rmd","doc4.Rmd")
    ```
    
    ```{r, child = child_docs}
    ```
    

    After implementing my own code in order to obtain the list of child docs to include.

提交回复
热议问题