communityMST: Calculate community's minimum spanning tree (MST)

Description Usage Arguments Details Value Examples

View source: R/fee_ind.R

Description

Get branch length information of MST for the community specified in abund in the trait space defined by spp_traits.

Usage

1
2
3
4
5
6
communityMST(
  abund,
  spp_traits,
  abundWeighted = TRUE,
  dis_metric = c("euclidean", "manhattan")
)

Arguments

abund

a numeric vector of species abundances in the community of interest. Species order in this vector needs to be same as that in species trait data (rows of spp_traits). Thus its length needs to be same as the number of rows in spp_traits.

spp_traits

a matrix (or data frame) of numeric functional traits for species. Columns are for different traits and rows are for different species in the species pool.

abundWeighted

logical; indicating whether the abundance values in abund are considered as weights in MST calculation. The default is TRUE.

dis_metric

string specifying the scheme of quantifying species dissimilarity in trait space. The currently available options are "euclidean" (the default) and "manhattan". Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences.

Details

...

Value

If abundWeighted is TRUE, return sorted branch lengths of abundance-weighted MST. If abundWeighted is FALSE, return sorted branch lengths of raw MST.

Examples

1
2
3
4
5
6
7
d_trait <- cbind(tr1 = rnorm(10, 0, 1), tr2 = rnorm(10, 3, 2))
comm1 = c(0:9)
comm2 = rep(1, 10)
communityMST(comm1, d_trait, abundWeighted = TRUE)
communityMST(comm1, d_trait)
communityMST(comm2, d_trait, abundWeighted = TRUE)
communityMST(comm2, d_trait)

tz05/FEE documentation built on Dec. 23, 2021, 1:03 p.m.