Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Markdown Template Creation

So I am just curious if anybody knows how to change the default R Markdown Creation file with the following output:

---
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.

When I create new R Markdown documents it would be a nice shortcut to avoid deleting this chunk and inserting a table of contents everytime.

like image 889
Cody Glickman Avatar asked Feb 28 '16 01:02

Cody Glickman


1 Answers

You can see this page for more details, but basically you just need to create a template.yaml file with an attached Rmarkdown template and put it in the right folder (inst/rmarkdown/templates). You can either create this from the menu in Rstudio "from template" or rmarkdown::draft("my_article.Rmd", template = "jss_article", package = "rticles").

like image 103
Chris C Avatar answered Sep 30 '22 14:09

Chris C