powered by
Computes Pielou's evenness index based on Shannon entropy for a nominal variable recorded as individual-level observations.
pielou_evenness(df, var)
A numeric value representing Pielou's evenness.
A data.frame or tibble containing the nominal variable.
Character string giving the name of the nominal variable in df.
df
Pielou's evenness is defined as: $$E = H / \log(S)$$ where \(H\) is Shannon entropy and \(S\) is the number of observed categories.
Values range from 0 (complete dominance by one category) to 1 (perfectly even distribution).
pielou_evenness(categories, "animal") pielou_evenness(categories2, "animal") pielou_evenness(categories3, "animal")
Run the code above in your browser using DataLab