Literate programming

Getting started

Markdown

## Concept

Exploration of population dynamic patterns at **The Portal Project**.
How do counts of rodents like *Dipodomys* species change through time?

In this document I will:

1. Load data from the [Portal Project Teaching Database](http://figshare.com/articles/Portal_Project_Teaching_Database/1314459)
2. Process it into population time series
3. And make initial visualizations

R chunks

## Required Packages

```{r}
library(dplyr)
library(ggplot2)
```
## Data

```{r}
data <- read.csv("https://ndownloader.figshare.com/files/2292172")
head(data)
```

Chunk options

```{r, message=FALSE}
library(dplyr)
library(ggplot2)
```
```{r, cache=TRUE}
data <- read.csv("https://ndownloader.figshare.com/files/2292172")
head(data)
```
The data includes `r length(unique(data$species_id))` species.

Analysis Example

## Analysis

Get the time-series of counts for all species.
          
```{r}
time_series <-
  data %>%
  group_by(species_id, year) %>%
  summarize(count = n()) %>%
  filter(species_id %in% c('DM', 'DO', 'DS')) %>%
  na.omit()

knitr::kable(head(time_series))
```
## Plot the time-series.

```{r, message=FALSE, echo=FALSE, cache=TRUE}
ggplot(time_series, aes(x = year, y = count)) +
  geom_point() +
  geom_line() +
  geom_smooth() +
  facet_wrap(~species_id)
```

Notebook

R Presentations

Untitled
========================================================
author: 
date: 
autosize: true


First Slide
========================================================

For more details on authoring R presentations please visit <https://support.rstudio.com/hc/en-us/articles/200486468>.

- Bullet 1
- Bullet 2
- Bullet 3

Slide With Code
========================================================

```{r}
summary(cars)
```