Learn R Programming

rdiversity (version 1.0)

subdiv: Calculate subcommunity-level diversity

Description

Generic function for calculating subcommunity-level diversity.

Usage

subdiv(data, qs)

# S4 method for powermean subdiv(data, qs)

# S4 method for relativeentropy subdiv(data, qs)

# S4 method for metacommunity subdiv(data, qs)

Arguments

data

matrix of mode numeric; containing diversity components.

qs

vector of mode numeric; parameter of conservatism.

Value

Returns a standard output of class tibble, with columns:

  • measure: raw or normalised, alpha, beta, rho, or gamma

  • q: parameter of conservatism

  • type_level: "subcommunity"

  • type_name: label attributed to type

  • partition_level: level of diversity, i.e. subcommunity

  • partition_name: label attributed to partition

  • diversity: calculated subcommunity diversity

Details

data may be input as three different classes:

  • power_mean: calculates raw and normalised subcomunity alpha, rho or gamma diversity by taking the powermean of diversity components

  • relativeentropy: calculates raw or normalised subcommunity beta diversity by taking the relative entropy of diversity components

  • metacommunity: calculates all subcommunity measures of diversity

References

Reeve, R., T. Leinster, C. Cobbold, J. Thompson, N. Brummitt, S. Mitchell, and L. Matthews. 2016. How to partition diversity. arXiv 1404.6520v3:1<U+2013>9.

Examples

Run this code
# NOT RUN {
# Define metacommunity
pop <- data.frame(a = c(1,3), b = c(1,1))
row.names(pop) <- paste0("sp", 1:2)
pop <- pop/sum(pop)
meta <- metacommunity(pop)

# Calculate subcommunity gamma diversity (takes the power mean)
g <- raw_gamma(meta)
subdiv(g, 0:2)

# Calculate subcommunity beta diversity (takes the relative entropy)
b <- raw_beta(meta)
subdiv(b, 0:2)

# Calculate all measures of subcommunity diversity
subdiv(meta, 0:2)

# }

Run the code above in your browser using DataLab