Learn R Programming

SCCI (version 1.2)

shannonEntropy: Shannon Entropy

Description

Calculates the Shannon entropy over data of a discrete random variable \(X\).

Usage

shannonEntropy(x)

Arguments

x

A discrete vector.

Examples

Run this code
# NOT RUN {
set.seed(1)
x = round((runif(1000, min=0, max=5)))
shannonEntropy(x=x)	## 2.522265
# }

Run the code above in your browser using DataLab