pm_list_genera: List genera in the Peruvian mammal backbone

View source: R/pm_explore.R

pm_list_generaR Documentation

List genera in the Peruvian mammal backbone

Description

Summarises the number of species and endemic species per genus. Optionally restricts the output to one or more orders and/or families. Genera with missing values are excluded from the results.

Usage

pm_list_genera(order = NULL, family = NULL)

Arguments

order

Optional character vector with one or more taxonomic orders to keep. If NULL (default), no filter is applied by order. Invalid order names will generate a warning.

family

Optional character vector with one or more families to keep. If NULL (default), no filter is applied by family. Invalid family names will generate a warning.

Details

The function validates input parameters and warns if invalid order or family names are provided. It also warns if the filters result in an empty dataset.

Value

A tibble with one row per genus and the following columns:

  • order – taxonomic order.

  • family – family name.

  • genus – genus name.

  • n_species – number of species in the genus.

  • n_endemic – number of endemic species in the genus.

Returns an empty tibble with the same structure if no records match the specified filters.

Examples

# All genera
pm_list_genera()

# Genera within Chiroptera (bats)
pm_list_genera(order = "Chiroptera")

# Multiple orders
pm_list_genera(order = c("Didelphimorphia", "Chiroptera"))

# Genera within a specific family
bat_genera <- pm_list_genera(family = "Phyllostomidae")

# Count total endemic species in a family
sum(bat_genera$n_endemic)

# Combination of filters
pm_list_genera(order = "Chiroptera", family = "Phyllostomidae")



perumammals documentation built on Jan. 6, 2026, 5:06 p.m.