---
title: "PSet 2: Who benefits when kangaroo rats are excluded?"
author: "Your name"
format:
  html:
    toc: true
    embed-resources: true
execute:
  message: false
bibliography: references.bib
---

```{r}
#| label: setup
library(tidyverse)
theme_set(theme_minimal(base_size = 12))
dir.create(here::here("figures"), showWarnings = FALSE)
```

# Prediction

Write 2–3 sentences before you look at the results.

# Methods

One short paragraph: the data, and how you calculated the capture rate (Task 6).

Data come from the Portal Project [@ernest2009; @portaldata].

# Task 1 — Join the tables

```{r}
#| label: import
# Blank cells are missing; the species code "NA" must stay a string.
captures <- read_csv(here::here("data", "captures.csv"),
                     na = "", show_col_types = FALSE) |>
  janitor::clean_names()
species <- read_csv(here::here("data", "species.csv"),
                    na = "", show_col_types = FALSE) |>
  janitor::clean_names()
plots <- read_csv(here::here("data", "plots.csv"),
                  na = "", show_col_types = FALSE) |>
  janitor::clean_names()
surveys <- read_csv(here::here("data", "surveys.csv"),
                    na = "", show_col_types = FALSE) |>
  janitor::clean_names()
```

```{r}
#| label: task-1
# Audit table, missing mass, captures_joined with left_join().
```

**Answer:**

# Task 2 — Count captures, keeping the zeros

```{r}
#| label: task-2
```

**Answer:**

# Task 3 — Compare treatments by year

```{r}
#| label: task-3
# Build plot_year, annual_rates, and difference_table.
```

```{r}
#| label: tbl-difference
#| tbl-cap: "Replace with a caption: what the columns are and their units."
# knitr::kable(difference_table, digits = 2)
```

**Answer:**

# Task 4 — Explore

## Trend plot

```{r}
#| label: task-4-trend
```

**Answer:**

## Two quick plots

```{r}
#| label: task-4-quick
```

**Answer:**

## Follow-up

```{r}
#| label: task-4-followup
```

**Question:**

**Observation:**

**What I'd check next:**

# Task 5 — Final figure

```{r}
#| label: fig-main
#| fig-cap: "Replace with a caption: what is shown, the years, and the data source."
#| fig-width: 7
#| fig-height: 4.5
# Make figure_1, print it, and ggsave() it as PDF and PNG.
```

# Conclusion

Write 100–150 words here. Refer to `@tbl-difference` and `@fig-main` (without the backticks) once they exist.

```{r}
#| label: session-info
sessionInfo()
```

# References

::: {#refs}
:::
