如果不知道RStudio维护pandoc的位置和访问细节,我决定自己安装pandoc.不幸的是,sudo apt-get install pandoc并不是很有帮助,因为Ubuntu可靠存储库(14.04LTS)中当前版本的pandoc是1.12.2.1.根据rmarkdown的消息,需要1.12.3或更高版本. “没什么大不了的”,我想,并且在存储库(http://johnmacfarlane.net/pandoc/installing.html)中版本太旧的情况下遵循安装pandoc的说明.这需要安装Haskell平台,这个平台非常大,输出相当冗长.过了一段时间,我终于遇到了以下失败消息:
- [ 6 of 57] Compiling Text.Pandoc.Readers.TeXMath ( src/Text/Pandoc/Readers/TeXMath.hs,dist/build/Text/Pandoc/Readers/TeXMath.o )
- src/Text/Pandoc/Readers/TeXMath.hs:30:38:
- Ambiguous occurrence `readTeXMath'
- It could refer to either `Text.Pandoc.Readers.TeXMath.readTeXMath',defined at src/Text/Pandoc/Readers/TeXMath.hs:56:1
- or `Text.TeXMath.readTeXMath',imported from `Text.TeXMath' at src/Text/Pandoc/Readers/TeXMath.hs:33:1-19
- (and originally defined in `Text.TeXMath.Parser')
- Failed to install pandoc-1.12.4.2
- cabal: Error: some packages Failed to install:
- pandoc-1.12.4.2 Failed during the building phase. The exception was:
- ExitFailure 1
- pandoc-citeproc-0.3.1 depends on pandoc-1.12.4.2 which Failed to install.
首先,我不确定如何解决它.其次,我非常怀疑应该有一种更简单的方法来享受使用rmarkdown和pandoc生成可重现的报告.您的建议将不胜感激!
更新(见评论):
- Rscript -e 'library(rmarkdown); render("knitr-example-slides-1.Rmd")'
- processing file: knitr-example-slides-1.Rmd
- |....... | 11%
- ordinary text without R code
- |.............. | 22%
- label: setup (with options)
- List of 1
- $include: logi FALSE
- Quitting from lines 6-8 (knitr-example-slides-1.Rmd)
- Error in eval(expr,envir,enclos) : object 'opts_chunk' not found
- Calls: render ... handle -> withCallingHandlers -> withVisible -> eval -> eval
- Execution halted
1)“Pandoc的二进制编译版本已经附带RStudio,因此您可以简单地创建一个符号链接,以便您可以轻松地在RStudio生态系统之外使用它:https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md#newer-systems-debianubuntufedora”;
2)我修复了错误,经过上面的建议(参见我的评论)后,通过使用显式包引用调用opts_chunk():knitr :: opts_chunk(),遵循以下指南:http://rmarkdown.rstudio.com/authoring_migrating_from_v1.html(感谢@Yihui指点我)在另一个问题中对本文件:Transitioning research project to knitr-based setup).