Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bookdown preview_chapter

Tags:

r

bookdown

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?

like image 981
Anthony W Avatar asked Aug 31 '26 00:08

Anthony W


1 Answers

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

like image 183
Yihui Xie Avatar answered Sep 02 '26 13:09

Yihui Xie