ecos_prepare_by_trait: Prepare counts data for trait-collapsed species

Description Usage Arguments Value Examples

View source: R/ecos_prepare_by_trait.R

Description

Starting from a taxonomic species abundance matrix, produces a new matrix, with features now collpased vesions of the species where the collapsing is done by trait level information. Binning is done on the species based on their trait level similarity- where similarity is determined by a dendogram produced by hierarchical clustering.

Usage

1
ecos_prepare_by_trait(counts, traits, prop_div = 0.3)

Arguments

counts

The abundance counts matrix with samples/sites along the rows and the species/features along the columns.

traits

A distance metric between species - a square matrix with species along rows and columns and the diagonal element equal to 0.

prop_div

The proportion of the original counts matrix diversity at which to cut the dendrogram.

Value

The output is a counts matrix with the columns corresponding to the species bins - each bin designated here by the first species entry into the bin.

Examples

1
2
3
4
5
6
7
8
data(himalayan_birds)
species_metadata <- pData(featureData(himalayan_birds))
taxonomic_counts <- t(exprs(himalayan_birds))
bill_traits <- as.matrix(dist(scale(species_metadata[,c(1:3)])))
counts_bill_traits <- ecos_prepare_by_trait(counts = taxonomic_counts, 
                                            traits = bill_traits, 
                                            prop_div=0.3)
                                                   

kkdey/ecostructure documentation built on Jan. 26, 2021, 4:10 p.m.