Learn R Programming

nomiShape (version 1.0.1)

pielou_evenness: Pielou's Evenness for Nominal Variables

Description

Computes Pielou's evenness index based on Shannon entropy for a nominal variable recorded as individual-level observations.

Usage

pielou_evenness(df, var)

Value

A numeric value representing Pielou's evenness.

Arguments

df

A data.frame or tibble containing the nominal variable.

var

Character string giving the name of the nominal variable in df.

Details

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).

Examples

Run this code
pielou_evenness(categories, "animal")
pielou_evenness(categories2, "animal")
pielou_evenness(categories3, "animal")

Run the code above in your browser using DataLab