R Markdown模板创建

时间:2016-02-28 01:08:13

标签: r markdown r-markdown

所以我很好奇是否有人知道如何使用以下输出更改默认的R Markdown Creation文件:

---
title: "Untitled"
author: "Cody Glickman"
date: "February 27, 2016"
output: html_document
---

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}
summary(cars)
```

You can also embed plots, for example:

```{r, echo=FALSE}
plot(cars)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

当我创建新的R Markdown文档时,这将是一个很好的快捷方式,可以避免每次删除此块并插入目录。

2 个答案:

答案 0 :(得分:3)

您可以查看this页面了解更多详情,但基本上您只需创建一个带有附加Rmarkdown模板的template.yaml文件并将其放在正确的文件夹(inst/rmarkdown/templates)中。您可以从Rstudio“from template”或rmarkdown::draft("my_article.Rmd", template = "jss_article", package = "rticles")

中的菜单创建

答案 1 :(得分:2)

您可以定义自己的模板,然后使用RStudio中的From Template创建新文档。见http://rmarkdown.rstudio.com/developer_document_templates.html