Learn R Programming

letsRept (version 1.1.0)

reptStats: Summarize Taxonomic Composition

Description

This function summarizes the taxonomic content of a species list, typically an object created with reptSpecies with higher taxa information. If no object is provided it summarizes the internal dataset allReptiles.

Usage

reptStats(
  x = letsRept::allReptiles,
  verbose = FALSE,
  order = NULL,
  suborder = NULL,
  family = NULL,
  genus = NULL
)

Value

Either a named list of taxonomic units (verbose = TRUE) or a data frame with taxonomic ranks and the number of units per rank (verbose = FALSE).

Arguments

x

A data frame containing reptile taxonomy data. Defaults to the internal dataset letsRept::allReptiles.

verbose

Logical. If TRUE, returns a list of taxon names by rank. If FALSE (default), returns a summary table of counts.

order

Optional. A character string specifying a taxonomic order to filter by (e.g., "Squamata").

suborder

Optional. A character string specifying a taxonomic suborder to filter by (e.g., "Serpentes").

family

Optional. A character string specifying a family to filter by (e.g., "Elapidae").

genus

Optional. A character string specifying a genus to filter by (e.g., "Micrurus").

Details

The output can be either a compact table with taxonomic unit counts or a verbose list of names within each rank.

Optional arguments allow the user to filter the dataset by specific taxonomic levels (e.g., order, suborder, family, genus) before summarizing.

Examples

Run this code
# Basic usage with default dataset
reptStats()

# Verbose summary listing elements in each rank
reptStats(verbose = TRUE)

# Filter by family and return summary table
reptStats(family = "Elapidae")

# Combine filters and return list
reptStats(suborder = "Serpentes", verbose = TRUE)

Run the code above in your browser using DataLab