R Markdown 在一个项目中找不到 .bib 文件,而在另一个项目中工作正常 [英] R Markdown Could not find .bib file in one project, whilst working fine in another
问题描述
在单击knit后,将Rmd很好地引用到文件x中,将引用添加到我的引用列表中,但是在文件y中,还设置了一个rmd文件,如下所示:
Rmd referencing fine in file x, after clicking knit adding references to my reference list, However in file y, also a rmd file set up as follows :
title: Swans
bibliography: library.bib
output: html_document
[@Ticehurst1957]
##bibloography
编织后,出现以下错误,但没有输出
after knitting, I get the following error and no output
输出文件:essay_swan_first.knit.md
output file: essay_swan_first.knit.md
pandoc-citeproc:找不到library.bibpandoc:运行过滤器/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc时出错错误:pandoc文档转换失败,错误83执行停止
pandoc-citeproc: Could not find library.bib pandoc: Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc Error: pandoc document conversion failed with error 83 Execution halted
怎么回事?
推荐答案
knitr
expects all paths to be either absolute or relative to your current R working directory. In an Rstudio project, the working directory is that where the project has been created (you can check this with getwd()
).
您需要将您的YAML标头修改为:
You need to either adapt your YAML header to:
---
bibliography: /path/to/library.bib
---
或在当前rstudio项目的文件夹中复制library.bib
Or copy library.bib in your current rstudio project's folder
这篇关于R Markdown 在一个项目中找不到 .bib 文件,而在另一个项目中工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!