Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set R bookdown input directory

Tags:

r

bookdown

I'd like to use bookdown to parse a series of .Rmd file into a book. If I have my .Rmd in the same directory as the main index.Rmd file then everything works fine and dandy. However, the .Rmd files are autogenerated from another source and I'd like to keep the input files in a subdirectory. Is it possible to do that?

I can include the file names in _bookdown.yml but I'd prefer not having to update that file every time a new .Rmd file is added.

The current version of _bookdown.yml looks like this

new_session: yes
rmd_files:
  html: ["input/index.Rmd", "input/01-file.Rmd"]
  latex: ["input/index.Rmd", "input/01-file.Rmd"]

I can move the files in a script but was hoping it was possible through bookdown itself.

like image 315
ekstroem Avatar asked Nov 13 '16 20:11

ekstroem


Video Answer


1 Answers

In the development version of bookdown you can now provide a list of subdirectories to be search recursively.

For example to have it search dir1/ and dir2/ (and their subdirectories) you can specify rmd_subdir: ["dir1/", "dir2/"] in the _bookdown.yml.

like image 84
Ellis Valentiner Avatar answered Nov 03 '22 22:11

Ellis Valentiner