Generates a sparse community matrix as input for clustering regions based on the similairity of functional traits across species.

counts(x, trait, cut = NULL, phy = NULL, bin = 10, na.rm = FALSE)

Arguments

x

A community data in long format with one column representing sites labeled “grids” and another column representing species labeled “species”.

trait

A data frame or matrix object with the first column labeled “species” containing the taxonomic groups to be evaluated whereas the remaining columns have the various functional traits. The variables must be a mix of numeric and categorical values.

cut

The slice time.

phy

is a dated phylogenetic tree with branch lengths stored as a phylo object (as in the ape package).

bin

The desired number of clusters or bins.

na.rm

Logical, whether NA values should be removed or not.

Value

Function returns a community data frame that captures the count of each species based on its cluster membership.