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

1 + 1

Code can have labels and specific processing options

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

Use back-ticks to evaluate R expressions

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