Skip to contents

Generate per-site rarefaction curves (expected richness vs. sample size) using vegan::rarecurve.

Usage

calculate_rarefaction(abund_matrix)

Arguments

abund_matrix

A site x species abundance data frame where the first column is site and remaining columns are species counts.

Value

A data frame with columns:

SiteID

Factor identifying the site (from abund_matrix$site).

SampleSize

Number of individuals subsampled.

RarefiedRichness

Expected species richness at that sample size.

Details

The result is returned in long (tidy) format with one row per site x sample size point. The SampleSize values come from the Subsample attribute provided by vegan::rarecurve.

Examples

if (FALSE) { # \dontrun{
rr <- calculate_rarefaction(abund_matrix)
head(rr)
} # }