shannon {pgirmess} | R Documentation |
Computes Shannon's and equitability indices
shannon(vect, proba=TRUE)
vect |
a probability vector whose sum = 1 or a frequency vector |
proba |
FALSE if the vector is frequencies and not probabilities |
Computes Shannon's and equitability indices. The vetor passed can be a probability vector whose sum equal 1 or a vector of frequencies (e.g. the number of food item of each category). In this case the argument proba must be set to FALSE.
A vector of two values: Shannon's and equitability indices
x<-c(0.1,0.5,0.2,0.1,0.1) sum(x) shannon(x) x<-rpois(10,6) shannon(x, proba=FALSE)