| calc_simpson_index | R Documentation |
The Simpson diversity index is calculated to measure the probability that two randomly selected individuals (e.g., molecular formulas) belong to the same category. It quantifies the dominance or evenness within a dataset.
The Simpson index is defined as:
D = \sum (p_i^2)
where:
p_i is the relative abundance of the i-th molecular formula.
The index ranges between 0 and 1:
A value near 0 indicates high diversity (even distribution of abundances).
A value of 1 indicates no diversity (one molecular formula dominates).
calc_simpson_index(mf, magnitude)
mf |
Character vector. A list of unique molecular formulas. |
magnitude |
Numeric vector. A list of respective abundances (intensities) for each molecular formula.
Must be non-negative and have the same length as |
A single numeric value representing the Simpson diversity index. Returns 0 if magnitude is all zeros.
calc_simpson_index(
mf = c("C10H20O5", "C12H18O3", "C18H30O6"),
magnitude = c(1982375, 2424, 312410)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.