entropy: Compute entropy of a categorical variable

View source: R/get_entropy.R

entropyR Documentation

Compute entropy of a categorical variable

Description

Computes the entropy of a categorical variable, with optional normalisation.

Usage

entropy(x, normalise = TRUE)

Arguments

x

A character vector representing observed categorical values.

normalise

Logical. If TRUE, entropy is normalised to range from 0 to 1. If FALSE, returns raw Shannon entropy.

Value

A numeric value representing the entropy of x.


o2ools documentation built on June 8, 2025, 10:18 a.m.