Skip to contents

This function calculates the Shannon entropy of a numeric vector.

Usage

entropy(x)

Arguments

x

A numeric vector containing the values for which entropy will be computed.

Value

A numeric value representing the entropy.

Examples

library(pliman)
x <- c(1, 2, 2, 3, 3, 3, 4, 4, 4, 4)
entropy(x)
#> [1] 1.279854