我开始使用rmarkdown和knitr了。在RStudio提供的示例文档中,我可以成功地使用render()生成一个在Chrome中显示良好的超文本标记语言文件。但是,当我单击knit按钮时,它会生成一个.markdown文件,然后返回以下错误,而不呈现预览:
Error generating HTML preview for ~/path/to/file/report.rmarkdown system error 2 (The system cannot find the file specified)
我认为它在潘多克阶段被搁置了。有没有可能RStudio在错误的地方寻找潘多克?Pandoc已经在C:\Program Files (x86)\Pandoc\pandoc.exe上安装了,但RStudio在C:\Program Files\RStudio\bin\pandoc\pandoc.exe上安装了自己的实例,所以可能它在错误的位置查找和/或混淆了一个和另一个的设置?
任何帮助都将不胜感激。谢谢!
为了以防万一,这里是我开始使用的RMarkdown模板:
---
title: "Monthly Report"
author: "Kris Shaffer"
date: "February 17, 2017"
output: html_document
---
```{r setup, include=FALSE}库(Knitr)
knitr::opts_chunk$set(echo =真)
## 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}摘要(汽车)
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}绘图(压力)
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.R版本3.3.2
RStudio 1.0.136
rmarkdown 1.3
针织1.15.1
pandoc 1.17.2 (两个安装)
发布于 2017-02-18 00:07:06
事实证明,它和文件扩展名一样简单。我将文件名从report.rmarkdown更改为report.Rmd。编织现在可以正常工作了。
https://stackoverflow.com/questions/42301881
复制相似问题