Rmarkdown编织错误:生成的代码中的错误/访问冲突

时间:2018-02-08 16:31:01

标签: rstudio r-markdown pandoc

我的环境中有一个特定的错误,因此无法将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
  • knitr:1.19
  • rmarkdown: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 Cache了。那也行不通。我浏览了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

任何帮助或想法都将不胜感激。

2 个答案:

答案 0 :(得分:0)

更新pandoc为我解决了这个问题。

https://pandoc.org/installing.html

感谢@EuGENE。在此处添加答案是为了清楚起见。

答案 1 :(得分:0)

最近在Win10上安装R&RStudio后遇到相同的问题。 Pandoc问题出现在以前免费的.rmd文件的编辑和编织中。

安装RStudio的最新预览版后解决。

https://www.rstudio.com/products/rstudio/download/preview/

相关问题