Calculate the Shannon's entropy.

entropy(x)

Arguments

x

a numeric vector.

Value

numeric. entropy

Examples

set.seed(123) x <- sample(1:10, 20, replace = TRUE) entropy(x)
#> [1] 4.179192