antclassify_community: Classify Ant Communities Across Multiple Sites

View source: R/antclassify_community.R

antclassify_communityR Documentation

Classify Ant Communities Across Multiple Sites

Description

Applies the AntClassify pipeline to each site (row) of a community matrix and returns aggregated guild abundance and richness matrices.

Usage

antclassify_community(comm, guild_col = "antclassify_guild", ...)

Arguments

comm

A community matrix with sites as rows and species as columns. Species names must match the nomenclature used in the internal databases.

guild_col

Character string giving the name of the guild column to use for aggregation. Must be one of "antclassify_guild", "silva_guild", "delabie_guild", or "silvestre_guild". Default is "antclassify_guild".

...

Additional arguments passed to assign_guild_ants (for example, validate, delay). Note that plot is always set to FALSE inside this function to avoid displaying one plot per site.

Value

A list with three components:

by_site

A list of length equal to nrow(comm). Each element contains the full output of assign_guild_ants for the corresponding site.

guild_abundance

A matrix of guild abundances (sites × guilds).

guild_richness

A numeric vector of length nrow(comm) giving the number of distinct guilds found at each site.

Examples

# Small community matrix with two sites and six species
comm <- matrix(c(5, 0, 2, 0, 1, 3,
                 2, 4, 0, 2, 0, 0),
               nrow = 2, byrow = TRUE,
               dimnames = list(c("Site1", "Site2"),
                               c("Atta sexdens", "Camponotus atriceps",
                                 "Pheidole megacephala", "Wasmannia auropunctata",
                                 "Solenopsis saevissima", "Nylanderia fulva")))

# Run the classification (validate = FALSE to avoid GBIF calls in examples)
results <- antclassify_community(comm, guild_col = "antclassify_guild",
                                 validate = FALSE)
results$guild_abundance
results$guild_richness

AntClassify documentation built on Sept. 4, 2026, 1:06 a.m.