knitHTML和rmarkdown呈现有什么区别?

时间:2014-06-06 13:51:34

标签: knitr rstudio r-markdown

我在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按钮按照代码的方式工作?

1 个答案:

答案 0 :(得分:1)

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