Tutorials

Learn how to use R.

Install

install.packages('rmarkdown')

Create document

We start by creating a document from a plain text file. In R-Studio, you can click New File (top left) R Markdown… and save the file.

Start with the following file header:

A rmarkdown file might look like the following.


---

title: "Something meaningful"

date: "2017-10-30"

output: html_document

---


Create headers with "###"

### This will be a section header (level H3)

Run r code by staring and ending the r code with "```"

Including 'echo=FALSE' is added to prevent printing of the r code

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

To create the HTML you only run the rmarkdown::render command. The command will read your rmd file and create an HTML that you can open in a web browser.

You can then render the file by typing

rmarkdown::render('/PATH/TO/FILE.rmd', c("html_document" ))

Cheatsheet

Refer to the Rmarkdown cheatsheet for a more complete list of Markdown syntax.

Introductory Tutorial

Great introductory tutorial