【问题标题】:Knit error in RStudio: pandoc conversion failed with error 23. Extension ascii_identifiers is not supported for markdownRStudio 中的编织错误:pandoc 转换失败,出现错误 23。markdown 不支持扩展 ascii_identifiers
【发布时间】:2020-03-18 20:40:15
【问题描述】:

在尝试将文档编入 html 时,RStudio 会挂起转换为 html 的部分。我环顾四周,似乎其他人在使用过时的 pandoc 版本时发生了这种情况。我将 pandoc 更新到 2.8。我收到标题中的错误。再次环顾四周,v 2.5 似乎很稳定。我安装了它,重新启动了我的计算机,但仍然出现同样的错误。

repex 是在 RStudio 中创建 RMarkdown 文件时的默认示例:文件 -> 新文件 -> R Markdown -> html。

---
title: "repexpandocerror23"
author: "Adam Korejwa"
date: "11/22/2019"
output: html_document
---

```{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.

【问题讨论】:

  • 请让这个问题可重现。这包括示例代码(包括列出非基础 R 包)、示例明确数据(例如,dput(head(x))data.frame(x=...,y=...))和预期输出。参考:stackoverflow.com/questions/5963269stackoverflow.com/help/mcvestackoverflow.com/tags/r/info
  • 一些想法:如果您在系统范围内安装了pandoc,那么如果您运行system("pandoc --version")system(paste(file.path(Sys.getenv("RSTUDIO_PANDOC"), "pandoc"), "--version")),您可能会发现不同(在Windows 上)(因为RStudio 拥有自己的安装的 pandoc 版本)。
  • 尽管安装了 2.5,但系统范围的 pandoc 似乎是 2.8。另一个命令返回状态 127: system(paste(file.path(Sys.getenv("RSTUDIO_PANDOC"), "pandoc"), "--version")) 警告消息:运行命令 'C:/Program Files/RStudio/ bin/pandoc/pandoc --version' 的状态为 127
  • 哦,对了,我讨厌 R 的 system。试试system(paste(shQuote(file.path(Sys.getenv("RSTUDIO_PANDOC"), "pandoc")), "--version"))
  • R 3.4.4,赢得 10。rmarkdown::pandoc_version() 给出 2.8。我用 install.packages('rmarkdown') 更新了 markdown 包,它现在似乎可以工作了。 pandoc_version() 仍然给出 2.8。

标签: r rstudio knitr pandoc


【解决方案1】:

两个月前我有fixed this issue。请确保您的 rmarkdown 版本至少为 v1.16。再次,when in doubt, consider updating your packages

update.packages(ask = FALSE, checkBuilt = TRUE)

【讨论】:

    猜你喜欢
    • 2020-02-22
    • 2019-10-14
    • 2017-05-08
    • 1970-01-01
    • 2015-07-29
    • 2016-06-26
    • 2018-02-23
    • 2014-09-26
    • 2018-10-31
    相关资源
    最近更新 更多