Search code examples
rbookdown

Bookdown preview_chapter


I don't seem to be able to get preview_chapter working on my r bookdown project. This is my _bookdown.yml file:

book_filename: "thesis"
delete_merged_file: true
output_dir: "docs"
new_session: yes 

rmd_files: # defines the .Rmd files to be included for each output format
  html: ["index.Rmd", "02-methodology.Rmd", "03-results.Rmd", "99_references.Rmd"]

When I use:

bookdown::render_book("index.Rmd", bookdown::'gitbook')

The entire book compiles correctly. But if I try to build a single chapter as follows:

 bookdown::preview_chapter("03-results.Rmd", bookdown::'gitbook')

I get:

Error in files2[[format]] : 
  attempt to select less than one element in get1index

Am I using an incorrect syntax?


Solution

  • bookdown::'gitbook' should be 'bookdown::gitbook'.