#' @title Shannon diversity index
#'
#' @description Computes Shannon's diversity index
#'
#' @param x Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed. 0 values are converted to NA.
#'
#' @return Shannon's diversity index (Entropy).
#'
#' @seealso \link{dec_shannon}, \link{equitability}
#'
#' @references
#' "Quantifying Diversity through Entropy Decomposition: Insights into Hominin Occupation and Carcass Processing at Qesem cave"
#'
#' @examples
#' data(Qesem_s)
#' shannon(Qesem_s$HU)
#'
#' @export
shannon <- function(x){
  x <- check_x(x)
  p <- x/sum(x)
  return(sum(-p*log(p)))
}
