powered by
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")
Named numeric vector containing entropy values
Data Frame to compute on
Unit to measure entropy. Either "bits" (default) or "nats".
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))
Run the code above in your browser using DataLab