Alpha diversity indices are calculated using ncopiesperml as a proxy of abundances.
Usage
summarize_alpha_diversity(species_df, .by = .data$samplename, .groups = NULL)
calc_alpha_div(mat)Arguments
- species_df
A data frame summarized by species, e.g., output of
summarize_ncopies().- .by
Passed to
dplyr::summarize().- .groups
Passed to
dplyr::summarize().- mat
A community composition matrix (samples x species), e.g., output of
pivot_wider_ncopies().
Details
The output from these two functions should be equivalent given the same input.
summarize_alpha_diversity() operates in a tidyverse style with longer data frames,
while calc_alpha_div() operates on a community composition matrix in wider format
using the vegan package.
Examples
if (FALSE) { # \dontrun{
species_df = ranemone::summarize_ncopies(community_df, .by = species)
res1 = ranemone::summarize_alpha_diversity(species_df)
species_mat = ranemone::pivot_wider_ncopies(community_df, .by = species)
res2 = ranemone::calc_alpha_div(species_mat)
stopifnot(all.equal(res1, res2))
} # }