# Diversity Indices

Your goal for this assignment is to find a dataset online that includes species abundances across different plots, sites, or regions. You will conduct diversity analyses on the dataset to compare diversity among these areas.

::: callout-note
## Tips

Your dataset should include different plots/sites/etc. (at least 3), different species (at least 10), and abundance data (either a column for abundance or where each row represents an individual).

If you are able to find a good dataset you want to use but there is not a column for abundance counts, but each *row* is an *individual* (like in a dataset of mice species, each row is an individual mouse e.g. row 1 is Mickey and row 2 in Minnie, etc.), you can still use that dataset by creating a population count column like this:

``` r
df_count <- df %>% 
    group_by(species, time) %>% 
    summarize(count = n(), .groups = "drop") %>%
    ungroup()
```

If your dataset has separate columns for each plot/habitat/region/etc. you will have to use pivot_longer() before you pivot_wider() while creating your community data matrix, like this:

``` r
pivot_longer(cols = <first site column name: last site column name>, names_to = "Sites", values_to = "Abundance", values_drop_na = TRUE)
```

If your dataset has an abundance column but also has repeated rows for some species/sites (if values are erroneously repeated, if if your dataset is over time, etc.), you can use the following to collapse your dataset:

``` r
  df_out <- df_in %>%
    group_by(<species column>, <site column>) %>%
    summarize(cumulative_abundance = sum(<abundance column>, .groups = "drop") %>%
    ungroup()
```
:::

### 0) Set-up your environment

```{r setup, include=FALSE}

```

### 1) Explore your dataset and describe what you see. Note what needs to be cleaned. Plot your data for initial analysis/description of your dataset. This could include histograms of species abundances or maps of the locations of plots. What trends do you see? Describe your dataset and how it was collected.

```{r}

```

```{r}

```

```{r}

```

```{r}

```

```{r}

```

```{r}

```

```{=plain}
```
### 2) Clean and wrangle your data, describing why you are conducting the cleaning steps you are taking.

*Hint: it will be helpful to have 3 objects: your clean dataset in long format, your clean data in wide format, and your clean dataset set-up as a community data matrix*

```{r}

```

```{r}

```

```{=plain}
```
```{r}

```

```{=plain}
```
```{r}

```

```{=plain}
```
### 3) Calculate and compare diversity metrics among at least 3 plots/sites/areas/etc. (*Hint: there were 3 different diversity metrics in lab, with the 3rd having two options for its calculation*). What do you observe? Does this align with what you expect from your plots/data above?

```{r}

```

```{r}

```

```{r}

```

```{r}

```

```{=plain}
```
### 4) Calculate and compare Euclidean, Bray-Curtis, and Jaccard distances for your data (all species and all plots). Create an NMDS plot with all data for both Bray-Curtis and Jaccard distances for your data. What do you observe?

```{r}

```

```{r}

```

```{r}

```

```{r}

```

```{r}

```

```{=plain}
```
### 5) Calculate Gini-Simpson Index, Simpson's Evenness, and Shannon Index values for your data. What do you observe?

```{r}

```

```{r}

```

```{r}

```

```{=plain}
```
### 6) What overall hypotheses or conclusions can you draw from your analysis of this dataset? Based on the flowchart from lab, which metric(s) do you think are most applicable for your dataset?

```{=plain}
```
