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)?
bookdown very frequently to write course material at our university. We use
_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 ...
_bookdown.yaml to specify the files is limiting in the following ways:
- it leads to a lot of repetition (e.g.
folder1is 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?
render_book(..., preview = TRUE) is not a solution, we would like to render the book with a specific set of rmd-files.