Getting Started with R Markdown
R Markdown
R Markdown documents can be used for fully reproducible statistical analysis. The link here describes in detail how to get started with Rmarkdown.
In brief, your R codes and plots can be embedded into your document as follows:
library(stats)
library(ggplot2)
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
ggplot(data=cars,aes(speed,dist)) +
geom_point() +
geom_smooth(method='lm') +
labs(x='Speed (mph)', y='Stopping distance (ft)', title='Linear Regression Plot') +
theme(plot.title = element_text(hjust=0.5, size=20, face='bold'))