#' Species Richness 3
#'
#' This package will calculate the species richness for a population. It accepts a population vector, then
#' calls on the universal_diversity4 function, and passes the population vector and a q value (q=0) to
#' it. universal_diversity4 will return a universal diversity, which species_richness3 will return as
#' a single numeric value of the species richness for the population argument.
#'
#' @param population - set of population counts, containing the number of individuals of each species within the population
#'
#' @return species.richness - the species richness for the population
#' @export
#'
#' @examples
species_richness4 <- function(population) {
species.richness <- universal_diversity4(population = population,
q = 0)
return(species.richness)
}
#' Simpson Diversity 4
#'
#' This package will calculate the Simpson Diversity for a population. It accepts a population vector, then
#' calls on the universal_diversity4 function, and passes the population vector and a q value (q=2) to
#' it. universal_diversity4 will return a universal diversity value. simpson_diversity3 will then divide 1
#' by the returned diversity measure to obtain a value for Simpson Diversity, and return this value as a
#' single numeric value of Simpson DIversity for the population.
#'
#' @param population a set of population counts, containing the number of individuals of each species within the population
#'
#' @return simpson.diversity - the Simpson Diversity for the population
#' @export
#'
#' @examples
simpson_diversity4 <- function(population) {
diversity <- universal_diversity4(population = population,
q = 2)
simpson.diversity <- (1/diversity)
return(simpson.diversity)
}
#' Shannon Entropy 4
#'
#' This package will calculate the Shannon Entropy for a population. It accepts a population vector, then
#' calls on the universal_diversity4 function, and passes the population vector and a q value (q=1) to
#' it. universal_diversity4 will return a universal diversity value. shannon_entropy3 will then calculate the
#' log of the returned diversity measure to obtain a value for Shannon Entropy, and return this value as a
#' single numeric value of Shannon Entropy for the population.
#'
#' @param population a set of population counts, containing the number of individuals of each species within the population
#'
#' @return shannon.entropy - the Shannon Entropy for the population
#' @export
#'
#' @examples
shannon_entropy4 <- function(population) {
diversity <- universal_diversity4(population = population,
q = 1)
shannon.entropy <- log(diversity)
return(shannon.entropy)
}
#' Berger-Parker 4
#'
#' This package will calculate the Berger-Parker Index of a population. It accepts a population vector, then
#' calls on the universal_diversity4 function, and passes the population vector and a q value (q=Infinity) to
#' it. universal_diversity4 will return a universal diversity value. shannon_entropy3 will divide 1 by
#' the returned diversity measure to obtain a value for the Berger-Parker Index, and return this value as a
#' single numeric value of Berger-Parker Index for the population.
#'
#' @param population a set of population counts, containing the number of individuals of each species within the population
#'
#' @return berger.parker - the Berger-Parker Index for the population
#' @export
#'
#' @examples
berger_parker4 <- function(population) {
diversity <- universal_diversity4(population = population,
q = Inf)
berger.parker <- 1/diversity
return(berger.parker)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.