View source: R/QC_info_theory.R
entropy | R Documentation |
Calculates Shannon Entropy of a vector in bits (default) or natural units. Missing values are omitted from the calculation.
entropy(x, unit = c("bits"))
x |
Input vector |
unit |
Unit to measure entropy. Either "bits" (default) or "nats". |
Entropy of input variable
Shannon, C. E. A mathematical theory of communication. The Bell System Technical Journal 27, 379–423 (1948).
# no entropy:
vec <- c(1,1,1,1,1,1)
entropy(vec)
# entropy
vec <- c(1,2,3,4,5,6)
entropy(vec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.