Ale*_*ekh 8 r pandoc knitr r-markdown reproducible-research
这个问题是我尝试从文档和R包创建可重现报告的一些经验的必然结果.虽然看起来转换是从RStudio(按钮)内自动完成的,但是我在RStudio()之外做同样的尝试失败了,因为根据消息,我的系统缺乏.这很可能是错误的,因为RStudio以某种方式设法执行转换.因此,它很可能是访问和/或路径问题.R Markdownknitrrmarkdown.Rmd => HTMLKnit HTMLRscript -e 'library(rmarkdown); render("knitr-example-slides-1.Rmd")'pandoc
如果不知道RStudio维护的位置pandoc和访问细节,我决定自己安装 pandoc.不幸的是,sudo apt-get install pandoc由于pandocUbuntu的trusty存储库(14.04LTS)的当前版本是1.12.2.1 这一事实并不是很有帮助.根据rmarkdown消息,需要1.12.3或更高版本."没什么大不了的",我想,并且pandoc在存储库(http://johnmacfarlane.net/pandoc/installing.html)版本太旧的情况下遵循安装说明.这需要安装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.
Run Code Online (Sandbox Code Playgroud)
首先,我不确定如何解决它.其次,我非常怀疑,应该有一个更简单的方法来享受产生具有重现性报告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
Run Code Online (Sandbox Code Playgroud)
基本上,@ daroczig在上面的评论中回答了这个问题,所以我将在这里重复一遍,并在主要问题的问题修复后出现,并在相关的小问题上添加答案.
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)在一个不同的问题中向我指出这个文件:将研究项目过渡到基于knitr的设置).
| 归档时间: |
|
| 查看次数: |
2584 次 |
| 最近记录: |