| shannon | R Documentation |
shannon calculates the Shannon Entropy of a vector. The entropy quantifies the expected value of the information contained in a
vector.
shannon(vec, data = NULL, base = 2)
vec |
The vector for which the Shannon Entropy is to be calculated. This is either a vector saved as object or a row of the |
data |
A data frame object or matrix. |
base |
Base of the logarithm to be used, defaults to |
D. Schmitz
### a vector saved as object
vector <- runif(50, 0, 10)
shannon(vec = vector)
shannon(vec = vector, base = 10)
### a vector specified by its name & its matrix
data("gdsm_mat")
shannon(vec = "var12", data = gdsm_mat)
shannon(vec = "var12", data = gdsm_mat, base = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.