---
title: R Markdown example
author: David A. Selby
date: 27 September 2016
---
The *World Almanac and Book of Facts* (1975) includes a dataset of heights (in) and weights (lbs) of 15 American women aged 30--39. It is built into `R`:
```{r women_eg, echo = 1, fig.show = 'hide'}
data(women)
plot(weight~height, data = women)
fit <- lm(weight ~ height, data = women)
abline(fit)
```
As height increases, weight appears to increases (almost) linearly: every inch in height adds approximately `r round(coef(fit)[2], 2)` lbs. This was determined by fitting a simple linear regression model of weight against height:
```{r women_eg, eval = FALSE, echo = 3}
```
The resulting least-squares regression line can be drawn on a scatter plot of height against weight. The fit looks quite good...
```{r women_eg, eval = TRUE, echo = c(2, 4)}
```