Nothing
#' @title Diversity indices
#'
#' @description Computes and prints all the diversity indices
#'
#' @param x Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species (in this case the Margalef and Menhinick indices and bootstrap intervals are not computed). NA values are allowed.
#' @param groups Vector of dimension S of factors indicating the groups. If omitted, the decomposition of the indicators is not done.
#' @param B Number of bootstrap samples. The default value is 1000.
#' @param cl Confidence level. A value between 0 and 1. The default value is 0.95.
#'
#' @return{No return value. It prints the value of all indicators}
#'
#' @seealso \link{shannon}, \link{dec_shannon}, \link{dominance}, \link{equitability}, \link{evenness}, \link{margalef}, \link{menhinick}, \link{simpson_D}, \link{simpson_E}
#'
#' @references
#' Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.
#'
#' @examples
#' data(Qesem_s)
#' all_indices(Qesem_s$HU)
#' all_indices(Qesem_s$HU, Qesem_s$Group)
#'
#' @export
all_indices <- function(x, groups = NULL, B = 1000, cl = 0.95){
xx <- check_x(x)
if (sum(xx) !=1){
cat("\n")
b <- bs(x, ind = "shannon", B = B, cl = cl)
if (!is.null(groups)) {
sh <- dec_shannon(x, groups)
cat("Shannon's diversity (Total):", sh$shannon, " (", b$ci[1],",", b$ci[2],")\n")
b <- bs_dec(x, groups, B = B, cl = cl)
cat("Decomposing Shannon's diversity:\n")
cat(" Within groups: ", sh$within, " (", b$ci_wt[1],",", b$ci_wt[2],")\n")
cat(" Between groups:", sh$between, " (", b$ci_bt[1],",", b$ci_bt[2],")\n")
cat(" Fraction Between/Total:", sh$between/sh$shannon,"\n")
cat(" Entropy within each group\n")
print(sh$g)
cat("\n")
} else {
cat("Shannon's diversity:", shannon(x), " (", b$ci[1],",", b$ci[2],")\n")
}
b <- bs(x, ind = "equitability", B = B, cl = cl)
cat("Equitability (J Pielou):", equitability(x), " (", b$ci[1],",", b$ci[2],")\n")
b <- bs(x, ind = "simpson_D", B = B, cl = cl)
cat("Simpson's dominance:", simpson_D(x), " (", b$ci[1],",", b$ci[2],")\n")
b <- bs(x, ind = "dominance", B = B, cl = cl)
cat("Dominance:", dominance(x), " (", b$ci[1],",", b$ci[2],")\n")
b <- bs(x, ind = "simpson_E", B = B, cl = cl)
cat("Simpson's evenness:", simpson_E(x), " (", b$ci[1],",", b$ci[2],")\n")
b <- bs(x, ind = "evenness", B = B, cl = cl)
cat("Evenness:", evenness(x), " (", b$ci[1],",", b$ci[2],")\n")
b <- bs(x, ind = "menhinick", B = B, cl = cl)
cat("Menhinick's Index:", menhinick(x), " (", b$ci[1],",", b$ci[2],")\n")
b <- bs(x, ind = "margalef", B = B, cl = cl)
cat("Margalef's Index:", margalef(x), " (", b$ci[1],",", b$ci[2],")\n")
cat("\nBootstrap confidence intervals at", cl,"confidence level between ()\n")
} else {
cat("\n")
if (!is.null(groups)) {
sh <- dec_shannon(x, groups)
cat("Shannon's diversity (Total):", sh$shannon, "\n")
cat("Decomposing Shannon's diversity:\n")
cat(" Within groups: ", sh$within, "\n")
cat(" Between groups:", sh$between, "\n")
cat(" Fraction Between/Total:", sh$between/sh$shannon,"\n")
cat(" Entropy within each group\n")
print(sh$g)
cat("\n")
} else {
cat("Shannon's diversity:", shannon(x), "\n")
}
cat("Equitability (J Pielou):", equitability(x), "\n")
cat("Simpson's dominance:", simpson_D(x), "\n")
cat("Dominance:", dominance(x), "\n")
cat("Simpson's evenness:", simpson_E(x), "\n")
cat("Evenness:", evenness(x), "\n")
}
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.