Learn R Programming

rdiversity (version 1.0)

repartition: Repartition metacommunity

Description

Randomly reshuffles the relative abundance of types (e.g. species) in a metacommunity (whilst maintaining the relationship between the relative abundance of a particular species across subcommunities). In the case of a phylogenetic metacommunity, the relative abundance of terminal taxa are randomly reshuffled and the relative abundance of types (historic species) are calculated from the resulting partition.

Usage

repartition(meta, new_partition)

Arguments

meta

object of class metacommunity.

new_partition

proportional abundance of types in the subcommunity as a fraction of the metacommunity as a whole (in the phylogenetic case, this corresponds to the proportional abundance of terminal taxa).

Value

Returns an object of class metacommunity.

Examples

Run this code
# NOT RUN {
tree <- ape::rtree(n = 5)
tree$tip.label <- paste0("sp", seq_along(tree$tip.label))
partition <- cbind(a = sample(5,5), b = sample(5,5))
row.names(partition) <- tree$tip.label
partition <- partition / sum(partition)
meta <- metacommunity(partition, tree)
meta@raw_abundance

a <- repartition(meta)
a@raw_abundance

# }

Run the code above in your browser using DataLab