taxize (version 0.1.5)

tax_agg: Aggregate species data to given taxonomic rank

Description

Aggregate species data to given taxonomic rank

Usage

tax_agg(x, rank, db = "ncbi", ...)

## S3 method for class 'tax_agg': print(x, ...)

Arguments

x
Community data matrix. Taxa in columns, samples in rows.
rank
character; Taxonomic rank to aggregate by.
db
character; taxonomic API to use, 'ncbi, 'itis' or both, see tax_name.
...
Other arguments passed to get_tsn or get_uid.

Value

  • A list of class tax_agg with the following items:
  • xCommunity data matrix with aggregated data.
  • byA lookup-table showing which taxa were aggregated.
  • n_preNumber of taxa before aggregation.
  • rankRank at which taxa have been aggregated.

Details

tax_agg aggregates (sum) taxa to a specific taxonomic level. If a taxon is not found in the database (ITIS or NCBI) or the supplied taxon is on higher taxonomic level this taxon is not aggregated.

See Also

tax_name

Examples

Run this code
# use dune dataset
data(dune, package='vegan')
species <- c("Bellis perennis", "Empetrum nigrum", "Juncus bufonius",
"Juncus articulatus",
"Aira praecox", "Eleocharis parvula", "Rumex acetosa", "Vicia lathyroides",
"Brachythecium rutabulum", "Ranunculus flammula", "Cirsium arvense",
"Hypochaeris radicata", "Leontodon autumnalis", "Potentilla palustris",
"Poa pratensis", "Calliergonella cuspidata", "Trifolium pratense",
"Trifolium repens", "Anthoxanthum odoratum", "Salix repens", "Achillea
millefolium",
"Poa trivialis", "Chenopodium album", "Elymus repens", "Sagina procumbens",
"Plantago lanceolata", "Agrostis stolonifera", "Lolium perenne", "Alopecurus
geniculatus",
"Bromus hordeaceus")
colnames(dune) <- species

# aggregate sample to families
agg <- tax_agg(dune, rank = 'family', db = 'ncbi')
agg

# extract aggregated community data matrix for further usage
agg$x
# check which taxa have been aggregated
agg$by

Run the code above in your browser using DataCamp Workspace