Capstone project for Data Carpentry course.

``````library(dplyr)
library(ggplot2)

There are 13 columns and 34786 rows.

## 2: Boxplots of weight by sex

Boxplots of weight by sex, omitting individuals with missing sex.

``````surveys %>% select(weight, sex) %>%
filter(sex != "", !is.na(sex)) %>%
ggplot() + geom_boxplot(aes(x=sex, y=weight))``````
``## Warning: Removed 856 rows containing non-finite values (stat_boxplot).``

## 3. Histogram of hindfoot lengths

``````surveys %>% filter(!is.na(hindfoot_length)) %>%
ggplot() + geom_histogram(aes(x=hindfoot_length), bins=150)``````

## 4. scatterplots of hindfoot length vs weight for 3 species

``````surveys %>% filter(species_id %in% c("DM", "DO", "DS")) %>%
filter(!is.na(weight), !is.na(hindfoot_length)) %>%
ggplot(aes(x=hindfoot_length, y=weight)) +
geom_point(aes(color=species_id)) + facet_grid(species_id ~ .)``````

## 5. Plot of counts of “DM” in “Rodent Exclosure” plots over time

``````counts <- surveys %>% filter(species_id == "DM") %>%
filter(plot_type=="Rodent Exclosure") %>%
group_by(year) %>%
tally()
counts %>% ggplot(aes(x=year, y=n)) + geom_line()``````