【发布时间】:2018-07-19 07:24:25
【问题描述】:
我的环境中有一个特定的错误,导致我无法始终如一地将 Rmarkdown 文件编入 HTML、Word 文档或 PDF。编织能力因文件类型而异。
- HTML - 有时会编织
- Word 文档 - 有时会编织
- PDF - 从不编织。总是抛出同样的错误
错误是:
Segmentation fault/access violation in generated code
Error: pandoc document conversion failed with error 1
直到一周前,我还能够在同一个环境中编织所有三种文件类型,所以这是一个相对较新的错误。我的环境的高级规范是:
- 操作系统:Windows 10
- R:3.4.3
- RStudio:1.1.419
- 针织机:1.19
- 降价:1.8
- pandoc:1.19.2.1
- MiKTeX:2.9
作为编织能力不一致的示例,我在 RStudio 中创建了一个新的 .Rmd 文件,该文件创建了熟悉的标准模板 summary(cars) 和 plot(pressure) 等。我没有对其进行任何更改。我能够成功地将它编织到 HTML 一次,Word .docx 一次,然后我尝试编织到 PDF 并得到上面的错误。然后我返回并尝试编织到 HTML 和 Word 并收到错误,即使原始编织没有任何变化。这只是行为类型的一个示例。不同的文档表现不同。
为了进行故障排除,我重新安装了 R 和 RStudio(我相信 pandoc 提供了 RStudio 安装,所以我也有效地重新安装了 pandoc)。重新安装没有帮助。我试过清除 Knitr 缓存。那也没有用。我浏览了 SO 和互联网,发现了一些与 Glasgow-Haskell 编译器相关的类似错误,但我不知道那是什么以及它是否是问题的根源。
以下是引发错误的 .Rmd 文件示例:
---
title: "Untitled"
author: "Vypa"
date: "February 8, 2018"
output:
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
这是完整的控制台错误:
Segmentation fault/access violation in generated code
Error: pandoc document conversion failed with error 1
In addition: Warning message:
running command '"C:/Users/Vypa/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS tst.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output tst.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\Vypa\Documents\R\R-3.4.3\library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\Vypa\AppData\Local\Temp\RtmpI9Gxsx\rmarkdown-str5db029544a23.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"' had status 1
Execution halted
任何帮助或想法将不胜感激。
【问题讨论】:
-
pandoc也是最新的吗? -
如果你写一个 .Rmd 文件的例子会有所帮助
-
嗨 EuGENE - 我想是的,因为
pandoc是随 RStudio 一起安装的,而且我有最新的稳定版 RStudio。但是,我无法在我的 RStudio 安装中找到确切的pandoc版本。 -
@romles 我认为函数是
rmarkdown::pandoc_version()来获取版本。pandoc_available()只是为我返回一个布尔值。我已经编辑了我的帖子以显示 pandoc 的版本,所以感谢您指出我的方向。 -
@romles 感谢您的帮助。我说得太早了。从 github 安装
rmarkdown然后重新启动 R 和 RStudio,我现在可以编织所有三种文档类型。如果您想回复此问题,我会将您的答案标记为正确。
标签: rstudio r-markdown pandoc