rare_plot: Rarefaction curve for nominal variables
Description
Generates a rarefaction curve showing the expected number of distinct
categories discovered as sampling effort increases. The curve is estimated
using Monte Carlo permutations of the observation order.
Usage
rare_plot(df, var, reps = 1000, max_effort = NULL)
Value
Invisibly returns a data frame containing:
effort: sampling effort
mean: expected number of categories
lowCI: lower confidence interval
highCI: upper confidence interval
Arguments
df
A data frame containing the nominal variable.
var
Character string specifying the nominal variable column.
reps
Number of random permutations used to estimate the curve.
The default is 1000. Smaller values can be used to reduce computation
time when working with large datasets, at the cost of less precise
confidence intervals.
max_effort
Maximum sampling effort to compute. If NULL (default),
the full sample size is used. For very large datasets, this argument
allows users to limit the rarefaction curve to a smaller number of
observations in order to explore how quickly categories accumulate
and to approximate the minimum sample size required to capture most
of the category diversity.