R Markdown

From Dave's wiki
Jump to navigation Jump to search

R Markdown is a format that enables easy authoring of reproducible web reports from R. It combines the core syntax of Markdown (an easy-to-write plain text format for web content) with embedded R code chunks that are run so their output can be included in the final document.

R Markdown

Use fenced code regions to embed R code

```{r}
1 + 1
```

Code can have labels and specific processing options

```{r md-cars-scatter, message=FALSE, fig.width=7, fig.height=5}
library(ggplot2)
qplot(hp, mpg, data=mtcars)+geom_smooth() 
```

Use back-ticks to evaluate R expressions

I counted `r 1 + 1` red trucks on the highway.

Links

http://rmarkdown.rstudio.com/

https://support.rstudio.com/hc/en-us/articles/200488468-R-Markdown

http://rmarkdown.rstudio.com/RMarkdownReferenceGuide.pdf