8 Diversity Metrics
Diversity metric in general combine the measure of taxonomic evenness and taxonomic richness.
A number of diversity metrics can be calculated using taxa_div():
- Shannon-Wiener Diversity (“shannon”)
 - Simpson’s Diversity (“simpson”)
 - Margalef’s Diversity (“margalef”)
 - Menhinick’s Diversity (“menhinick”)
 - Pielou Evenness (“pielou”)
 
8.1 Community Diversity
div.df <- nest.df %>% 
  dplyr::mutate(
    shannon_genus = taxa_div(.dataframe = .,
                             .key_col = uid,
                             .counts_col = total,
                             .group_col = genus,
                             .job = "shannon",
                             .base_log = 2,
                             .unnest_col = data),
    simpson_genus = taxa_div(.dataframe = .,
                             .key_col = uid,
                             .counts_col = total,
                             .group_col = genus,
                             .job = "simpson",
                             .unnest_col = data),
    margalef_genus = taxa_div(.dataframe = .,
                              .key_col = uid,
                              .counts_col = total,
                              .group_col = genus,
                              .job = "margalef",
                              .unnest_col = data),
    menhinick_genus = taxa_div(.dataframe = .,
                               .key_col = uid,
                               .counts_col = total,
                               .group_col = genus,
                               .job = "menhinick",
                               .unnest_col = data),
    pielou_genus = taxa_div(.dataframe = .,
                            .key_col = uid,
                            .counts_col = total,
                            .group_col = genus,
                            .job = "pielou",
                            .unnest_col = data)
  )