Bookdown预览章节

3

我似乎无法在我的r bookdown项目中让preview_chapter正常工作。这是我的_bookdown.yml文件:

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"]

当我使用:

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

整本书编译正确。但是如果我尝试按以下方式构建单个章节:
 bookdown::preview_chapter("03-results.Rmd", bookdown::'gitbook')

我得到:

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

我是否使用了错误的语法?


这可能是因为之前的代码块尚未运行,因此编织环境无法访问 files2。您可以通过在相应章节中尝试访问该对象来测试是否属实。 - mhovd
谢谢。我需要把所有的.Rmd文件放在一个.RProj中吗? - Anthony W
1
我不确定,但我不认为会有问题。只要你的结构保持不变(并且主文件在同一个目录中)。 - mhovd
1个回答

3

bookdown::'gitbook' 应该改为 'bookdown::gitbook'


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接