#' Cumulative Richness function for FCM data
#'
#' This function calculates Hill diversity metrics from FCM data
#' @param x flowbasis object generated by flowBasis()
#' @param d Rounding factor for density values. Defaults to 4.
#' @keywords cumulative richness, fcm, alpha
#' cum_Richness(x)
cum_Richness <- function(x, d = 3) {
x = round(x, d)
x = x[x != 0]
x = x[rev(order(x))]/sum(x)
for (i in 1:(length(x) - 1))
{
x[i + 1] = x[i + 1] + x[i]
}
y = seq(0, 1, by = (1/(length(x) - 1)))
result = cbind(y, x)
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.