Skip to contents

From a summary table of camera/species, return richness, Shannon and Simpson diversity indices.

Usage

get_diversity_indices(
  dfcount,
  spp_col,
  cam_col,
  count_col = "individuals",
  prop_col = "individuals_prop"
)

Arguments

dfcount

Dataframe summarizing counts per species. Can be computed using the records dataframe with the summarize_species function.

spp_col

Name of the column containing species names

cam_col

Name of the column containing cameras names

count_col

Name of the column containing species counts

prop_col

Name of the column containing species proportions

Value

A dataframe with one row per camera summarizing diversity indices.

Details

Computes the richness, Shannon and Simpson indices. See vignette("diversity", package = "camtrapviz") for details on the formulas of the diversity indices.

Examples

countdf <- data.frame(camera = c("C1", "C1", "C1", "C2",
                                 "C3", "C3", "C3"),
                      species = c("cat", "cow", "rabbit",
                                  "cat", "cat", "cow", "rabbit"),
                      individuals = c(30, 30, 30, 30, 88, 1, 1),
                      individuals_prop = c(1/3, 1/3, 1/3, 1, 88/90, 1/90, 1/90))
get_diversity_indices(countdf, 
                      spp_col = "species", cam_col = "camera")
#>   camera richness   shannon   simpson
#> 1     C1        3 1.0986123 0.3258427
#> 2     C2        1 0.0000000 1.0000000
#> 3     C3        3 0.1219692 0.9558052