Skip to contents

Construct a tidy table for rank-abundance plotting by combining the observed species counts in species_dist with the theoretical Fisher log-series abundances implied by P.

Usage

calculate_rank_abundance(species_dist, P)

Arguments

species_dist

An sf point object with a character column species giving per-individual species identities.

P

A named list as returned by load_config containing at least the fields used by generate_fisher_log_series: N_SPECIES, N_INDIVIDUALS, DOMINANT_FRACTION, FISHER_ALPHA, and FISHER_X.

Value

A data frame with columns:

Rank

Integer species rank (1 = most abundant).

Abundance

Non-negative integer abundance.

Source

"Observed" or "Theoretical".

Details

Observed abundances are computed with base R table(), ranked in descending order, and annotated as Source = "Observed". Theoretical abundances are generated via generate_fisher_log_series using parameters in P (e.g., N_SPECIES, N_INDIVIDUALS, FISHER_ALPHA, FISHER_X, DOMINANT_FRACTION) and annotated as Source = "Theoretical". The two data frames are row-bound.

Examples

if (FALSE) { # \dontrun{
ra <- calculate_rank_abundance(species_dist, P)
head(ra)
} # }