#' Species Richness
#'
#' A function to calculate the Species Richness of a population passed to the function, and return this
#' value as a single integer.
#'
#' @param population - a vector of species counts
#'
#' @return species.richness
#' @export species.richness - a count of the number of species present in "population"
#'
#' @examples
species_richness_1 <- function(population) {
# find all the species which are present in the population
species.presence <- population > 0
# calculate the species richness (the total number of species present in the population)
species.richness <- sum(species.presence)
print(species.richness)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.