View source: R/QC_info_theory.R
variable_entropy | R Documentation |
Calculates Shannon entropy of all variables in a data frame in bits (default) or natural units. Missing values are omitted from the calculation.
variable_entropy(data, unit = "bits")
data |
Data Frame to compute on |
unit |
Unit to measure entropy. Either "bits" (default) or "nats". |
Named numeric vector containing entropy values
Shannon, C. E. A mathematical theory of communication. The Bell System Technical Journal 27, 379–423 (1948).
a <- matrix(c(c(1,1,1,1,1,1, 1,2,3,4,5,6)),ncol = 2, dimnames =
list(seq(1,6), c("no_entropy","entropy")))
variable_entropy(as.data.frame(a))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.