#' Species Richness 2
#'
#' This function takes a population of species counts vector, then passes it, along with a value of q (=0) to
#' the universal_diversity2 function. Universal_diversity2 calculates a diversity measure based on the
#' population and the value for q passed to it, and returns this value. species_richness does not alter
#' this value any further, it simply returns it as a single numerical value.
#'
#' @param population - a set of population counts, containing the number of individuals of each species within the population
#'
#' @return species richness - a calculation of the species richness of the entered population
#' @export
#'
#' @examples
species_richness2 <- function(population) {
species.richness <- universal_diversity2(population = population,
q = 0)
return(species.richness)
}
#' Simpson Diversity 2
#'
#' This function takes a population vector as its argument, then calls on the function universal_diversity2,
#' supplying it with the population argument, and a value for q (=2). Universal diversity then calulcates
#' a universal diversity measure based on the population and q value, and passes it back to simpson_diversity2
#' which calculates 1/"universal diversity measure", to return the Simpson diversity index.
#'
#' @param population - a set of population counts, containing the number of individuals of each species within the population
#'
#' @return simpson.diversity - a measurement of the simpson diversity for the entered population
#' @export
#'
#' @examples
simpson_diversity2 <- function(population) {
# call on the universal diversity function, and supply it with a q value for calculation of simpson diversity
diversity <- universal_diversity2(population = population,
q = 2)
# calculate the Simpson Diversity index, which is 1/the diversity measure returned by universal_diversity2
simpson.diversity <- (1/diversity)
return(simpson.diversity)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.