2017-02-17 5 views
1

Я начинаю с и knitr. В образце документа, предоставленного RStudio, я могу успешно использовать render() для создания HTML-файла, который отлично просматривается в Chrome. Однако, когда я нажимаю на кнопку knit, он генерирует .markdown файл, а затем возвращает следующую ошибку без предоставления предварительного просмотра:Knitr Предварительный просмотр HTML не удается в RStudio, хотя render() успешно создает файл HTML

Error generating HTML preview for ~/path/to/file/report.rmarkdown system error 2 (The system cannot find the file specified)

Я думаю, что она становится повесила на стадии pandoc. Возможно ли, что RStudio ищет pandoc в неправильном месте? 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} 
library(knitr) 
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 версия 3.3.2
RStudio 1.0.136
rmarkdown 1.3
knitr 1.15.1
pandoc 1.17.2 (обе установки)

ответ

0

Оказывается, это было так же просто, как расширение файла. Я сменил имя файла с report.rmarkdown на report.Rmd. Вязание прекрасно работает.

Смежные вопросы