Specify rmd_files explicitly in bookdown::render_book()

I had posted this question on stackoverflow, but didn't receive an answer there. Hope you people can help!

TL;DR: Is there a way to explicitly specify the rmd_files to be rendered in a function, e.g. render_book() (other than using preview = TRUE)?

Background:

We use bookdown very frequently to write course material at our university. We use rmd_files: within _bookdown.yaml to specify the rmd-files to be included in the book. Our bookdown projects tend to become rather long and complex, and _bookdown.yamlends up looking something like this:

rmd_files:
- index.Rmd
- folder1/subfolder1/file1.Rmd
- folder1/subfolder1/file2.Rmd
- folder1/subfolder2/file3.Rmd
- folder2/subfolder3/file4.Rmd
...

Using _bookdown.yaml to specify the files is limiting in the following ways:

  • it leads to a lot of repetition (e.g. folder1 is repeated for each child element)
  • the complex structure is implicit and obscure
  • selecting only a subset of files to be rendered involves manual labour (say I just want to use all files from folder 1)

So we have moved over to depicting our file-structure in a separate yaml file and using helper functions to update _bookdown.yaml according to our needs. This method seems a bit clunky, and it would be much more elegant if we could pass a character vector of filenames to render_book() instead of specifying the rmd-files in _bookdown.yaml. Is that possible?

Note: using render_book(..., preview = TRUE) is not a solution, we would like to render the book with a specific set of rmd-files.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.