```{r, echo=FALSE, warning=FALSE, message=FALSE}
require(knitr)
opts_chunk$set(warning=FALSE,message=FALSE)
```

## Data Taxonomy

![data taxonomy](https://andrewpbray.github.io/data-taxonomy.png)


## Numerical descriptors | One Variable {.build}
- **Shape**: uni- or multi-modal? right- or left-skewed?
- **Center**: `mean()`, `median()`, mode (`table()`)
- **Spread**: `sd()`, `var()`, `iqr()`

For a one stop shop: `summary()`.


## 7 Billion: Are you typical?

[nat geo video](http://www.youtube.com/watch?v=4B2xOvKFFz4)


## 7 Billion: Are you typical?
1.  What variables do we have data on?  What type of data is each?
2.  What numerical descriptors are referenced in the video?
3.  Write out pseudo-R-code that could have generated the statistic about the 
average height of the Dutch (that is, invent your own dataframe and column names,
but use R syntax).


## Graphical descriptors | Categorical Data: bar chart (base) {.build}

```{r, echo=FALSE}
require(mosaic)
download.file("http://www.openintro.org/stat/data/nc.RData", destfile = "nc.RData")
load("nc.RData")
```

```{r}
barplot(table(nc$premie))
```


## Graphical descriptors | Categorical Data: bar chart (ggplot2) {.build}

```{r}
ggplot(nc, aes(premie)) + geom_bar()
```


## Graphical descriptors | Categorical Data: pie chart (base) {.build}

```{r}
pie(table(nc$premie))
```


## Graphical descriptors | Categorical Data: pie chart (base) {.build}

![confusion](http://librarylostfoundblog.files.wordpress.com/2013/06/the-oatmeal.jpg)

Pie charts = confusion


## Graphical descriptors | Numerical Data: histogram (base) {.build}

```{r}
hist(nc$weight)
```


## Graphical descriptors | Numerical Data: histogram (ggplot2) {.build}

```{r}
ggplot(nc, aes(weight)) + geom_histogram()
```


## Graphical descriptors | Numerical Data: density plot (base) {.build}

```{r}
plot(density(nc$weight))
```


## Graphical descriptors | Numerical Data: density plot (ggplot2) {.build}

```{r}
ggplot(nc, aes(weight)) + geom_density()
```


## Graphical descriptors | Numerical Data: boxplot (base) {.build}

```{r}
boxplot(nc$weight)
```


## Graphical descriptors | Numerical Data: boxplot (ggplot2) {.build}

```{r}
ggplot(nc, aes(y = weight, x = factor(1))) + geom_boxplot()
```


## Numerical descriptors | Two (numerical) Variables {.build}

1. **Shape**: linear, quadratic
2. **Direction**: positive/neg in slope/curvature
3. **Strength**: how tightly clustered?

A measure of the strength of a linear relationship: r, the correlation coefficient
(`cor()`).


## Graphical descriptors | Scatterplot (base) {.build}

```{r}
plot(x = nc$fage, y = nc$mage)
```


## Graphical descriptors | Scatterplot (base) {.build}

```{r}
plot(mage ~ fage, data = nc)
```


## Graphical descriptors | Scatterplot (ggplot2) {.build}

```{r}
ggplot(nc, aes(x = fage, y = mage)) + geom_point()
```


## ggplot2 sandbox

```{r, eval = FALSE}
mplot(nc)
```


```{r submit-time-data}
d <- read.csv("submit-times.csv")
d <- as.character(d[,1])
a <- d[d != "-"]
datestamp <- unlist(strsplit(a, ", "))[seq(2, length(a)*3, 3)]
timestamp <- unlist(strsplit(a, ", "))[seq(3, length(a)*3, 3)]
dt <- POSIXlt()
```





