Construct a tidy table for rank-abundance plotting by combining
the observed species counts in species_dist with the
theoretical SAD abundances implied by P.
Arguments
- species_dist
An
sfpoint object with a character columnspeciesgiving per-individual species identities.- P
A named list as returned by
load_configcontaining at least the fields used bygenerate_sad:N_SPECIES,N_INDIVIDUALS, andSAD_MODEL(plus any model-specific parameters).
Value
A data frame with columns:
RankInteger species rank (1 = most abundant).
AbundanceNon-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_sad using parameters in P
(e.g., N_SPECIES, N_INDIVIDUALS, and SAD_MODEL; plus
model-specific parameters such as 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)
} # }