metacommunityFunctions to check if an object is a metacommunity or coerce an
object into a metacommunity.
metacommunity(partition, similarity, ...)# S4 method for data.frame,missing
metacommunity(partition)
# S4 method for numeric,missing
metacommunity(partition)
# S4 method for matrix,missing
metacommunity(partition)
# S4 method for data.frame,matrix
metacommunity(partition, similarity)
# S4 method for numeric,matrix
metacommunity(partition, similarity)
# S4 method for matrix,matrix
metacommunity(partition, similarity)
# S4 method for missing,phylo
metacommunity(partition, similarity, depth = 1)
# S4 method for numeric,phylo
metacommunity(partition, similarity, depth = 1)
# S4 method for data.frame,phylo
metacommunity(partition, similarity, depth = 1)
# S4 method for matrix,phylo
metacommunity(partition, similarity, depth = 1)
is.metacommunity(x)
two-dimensional matrix of mode numeric
with rows as types, columns as subcommunities, and elements containing
the relative abundances of types in subcommunities. For phylogenetic
diversity, see Details.
(optional) two-dimensional matrix of mode
numeric, with rows as types, columns as types, and elements
containing the pairwise similarity between types. For phylogenetic
diversity, see Details.
(optional) additional arguments, especially:
(optional; and for phylogenetic metacommunities only) how much evolutionary history should be retained, with 0 marking the most recent present-day species, and 1 (the default) marking the most recent common ancestor. Numbers greater than 1 extend the root of the tree.
any R object
Returns an object of class metacommunity (see Fields).
Returns TRUE if its argument is a metacommunity, FALSE otherwise.
type_abundancetwo-dimensional matrix of mode numeric
with rows as types, columns as subcommunities, and elements containing
relative abundances of types in subcommunities. In the phylogenetic case,
this corresponds to the proportional abundance of historic species, which
is calculated from the proportional abundance of present day species.
similaritytwo-dimensional matrix of mode numeric with
rows as types, columns as types, and elements containing pairwise
similarities between types
ordinarinesstwo-dimensional matrix of mode numeric
with rows as types, columns as subcommunities, and elements containing the
ordinariness of types within subcommunities
subcommunity_weightsvector of mode numeric; contains
subcommunity weights
type_weightstwo-dimensional matrix of mode numeric,
with rows as types, columns as subcommunities, and elements containing
weights of types within a subcommunity
raw_abundance[Phylogenetic] two-dimensional matrix of mode
numeric with rows as types, columns as subcommunities, and elements
containing the relative abundance of present day species
raw_structure[Phylogenetic] two-dimensional matrix of mode
numeric with rows as historical species, columns as present day
species, and elements containing historical species lengths within lineages
parameters[Phylogenetic] tibble containing parameters
associated with each historic species in the phylogeny
When calculating phylogenetic diversity either:
set partition as the relative abundance of present-day species,
with similarity as an object of class phylo, from which the
relative abundance and pairwise similarity of historical species will be
calculated; or
set partition as the relative abundance of historical species,
with similarity as the pairwise similarity of historical species.
# NOT RUN {
tree <- ape::rtree(n = 5)
tree$tip.label <- paste0("sp", seq_along(tree$tip.label))
partition <- cbind(a = c(1,1,1,0,0), b = c(0,1,0,1,1))
row.names(partition) <- tree$tip.label
partition <- partition / sum(partition)
a <- metacommunity(partition, tree)
b <- metacommunity(partition)
# }
Run the code above in your browser using DataLab