【问题标题】:What is the difference between knitHTML and rmarkdown render?knitHTML 和 rmarkdown 渲染有什么区别?
【发布时间】:2014-06-06 13:51:34
【问题描述】:

我在 Windows 7 上使用 RStudio 版本 0.98.501、R 版本 3.0.2。我在 .Rmd 文件中编写了以下代码:

---
title: "Sample Document"
output:
  html_document:
    toc: true
    theme: united
---


Title
========================================================

This is an R Markdown document. Markdown is a simple formatting syntax for authoring web pages (click the **Help** toolbar button for more details on using R Markdown).

When you click the **Knit HTML** button a web page 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}
summary(cars)
```

You can also embed plots, for example:

```{r fig.width=7, fig.height=6}
plot(cars)
```

Literature Review
==================
this is sample text

Hello
------

World!

### Subsection

this is subsection

当我单击knitHtml 按钮时,创建的 html 文件不包含目录。但是,当我使用以下代码时,它会创建目录并将主题更改为united

rmarkdown::render('C:/Users/durraniu/Documents/Trajectory1/knitHtml/test.Rmd')

有什么区别以及如何使 knitHtml 按钮按照代码的方式工作?

【问题讨论】:

    标签: knitr rstudio r-markdown


    【解决方案1】:

    RStudio 版本 0.98.501 不支持 rmarkdown 包。您必须查看最新的预览版(目前为 v0.98.894)。

    【讨论】:

    • 感谢@Yihui 的回复。但就我而言,rmarkdown 在 0.98.501 版本上运行良好。我想知道这两个选项有什么区别?
    • 我已将 RStudio 更新到 v.0.98.894,当我将 knitHtml 写入上述文件时,它工作正常。但是当我添加外部图像时,例如![alt text](C:/Users/durraniu/Documents/Trajectory1/images/vissim-view.png)它不起作用并给出错误pandoc.exe: Failed to retrieve C:/Users/durraniu/Documents/Trajectory1/images/vissim-view.png InvalidUrlException "C:/Users/durraniu/Documents/Trajectory1/images/vissim-view.png" "Invalid scheme" Error: pandoc document conversion failed with error 61这是什么意思?
    • @umairdurrani 除非万不得已,否则切勿使用绝对路径。尽可能使用相对路径。 Rstudio 0.98.501 实际上使用了类似 markdown 包 (cran.rstudio.com/package=markdown) 的东西,而不是 rmarkdown。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-25
    • 2016-09-15
    • 2015-03-14
    • 2021-06-19
    • 2019-06-11
    • 2021-05-23
    相关资源
    最近更新 更多