R/entropy.R
entropy.Rd
Calculates the entropy of a category. It uses the amount of categories to scale between 0 and 1.
entropy(x)
A character or vector with two or more categories
The numeric value of the Shannon entropy scaled between 0 and 1.
It omits the NA if present.
NA
entropy(c("H", "T", "H", "T")) #> [1] 1 entropy(c("H", "T", "H", "T", "H", "H", "H")) #> [1] 0.8631206 entropy(c("H", "T", "H", "T", "H", "H", NA)) #> [1] 0.9182958 entropy(c("H", "T", "H", "T", "H", "H")) #> [1] 0.9182958 entropy(c("H", "H", "H", "H", "H", "H", NA)) #> [1] 0