Published January 23, 2026 | Version v.0.1.1
Software Open

traitscrape: An R tool for extracting and summarising coral traits from the CoralTrait Database

Authors/Creators

Description

traitscrape is an R package designed to rapidly retrieve categorical coral trait information from the CoralTrait Database (www.coraltraits.org) and summarise traits at both the species and genus levels. It is built to support ecological, demographic, and resilience-based analyses where trait data must be extracted consistently and reproducibly across species lists or entire genera.

This release (v0.1.0) provides a stable version of the package intended for scientific use and long-term reproducibility.

Installation

install.packages("remotes")

remotes::install_github("dohertyml/traitscrape")

Core functionality

1. spp_scrape() — Species-level trait extraction

spp_scrape() accepts any character vector of coral binomials and performs the following steps:

  1. Cleans and standardises species names

  2. Matches them to CoralTraits species records

  3. Retrieves selected categorical traits for each species via CoralTraits’ public endpoints

  4. Returns a tidy tibble with:

    • species ID

    • species name

    • genus

    • trait ID

    • trait name

    • trait value

    • the CoralTraits URL used

    • HTTP status indicators

    • cleaned species names for matching

This is the recommended function when users have a verified species list for their region, ensuring that only locally present species are used in any trait analysis.

2. genus_scrape() — Genus-level retrieval

genus_scrape() retrieves all species belonging to specified genera in CoralTraits, then extracts trait observations for every species × trait combination.

This function is intended for use cases where:

  • species-level identification is incomplete or uncertain

  • researchers only have a genus list from a survey

  • traits must be inferred at genus level

  • broad structural or life-history patterns are being analysed

This avoids the need to manually compile global species lists for each genus, and guarantees consistent pulling of all available CoralTraits trait entries.

3. dominant_traits() — Genus-level trait summarisation

Trait values vary across species within a genus. To support higher-level trait analyses, dominant_traits() collapses species-level trait observations to a single representative value per genus × trait.

It provides:

  • modal trait value per genus

  • optional tie handling ("first" or "NA")

  • counts of species contributing to each modal category

This produces a clean genus × trait table suitable for demographic modelling, resilience comparisons, or trait-based community analyses.

Trait set included

By default, traitscrape extracts the most widely used categorical coral traits:

  • Life history strategy (Darling et al. 2012)

  • Sexual system

  • Mode of larval development

The life history strategy trait in particular follows the Darwinian / functional ecology framework introduced by Darling et al. (2012), which classifies corals into competitive, stress-tolerant, weedy, or generalist strategies. This classification underpins much modern resilience, demographic, and recovery modelling.

Users may optionally supply custom trait IDs or additional traits to the scraper.

Workflow overview

  1. Prepare a vector of species names or genus names

  2. Call spp_scrape() or genus_scrape()

  3. Inspect or clean the resulting trait table

  4. Optionally call dominant_traits() to obtain a genus-level summary

  5. Use resulting tables in demographic models, Bayesian analyses, community comparisons, or trait-based resilience assessments

All functions return clean, analysis-ready data frames and require minimal additional processing.

Example workflow

1. Scrape traits for a list of species

 
spp <- c("Acropora cervicornis", "Porites porites", "Favia fragum")
 
traits_spp <- spp_scrape(spp, verbose = TRUE)
 
head(traits_spp)

2. Scrape all species within selected genera

genera <- c("Porites", "Acropora")
 
traits_gen <- genus_scrape(genera, verbose = TRUE)

3. Summarise genus-level dominant traits

 
genus_traits <- dominant_traits(traits_gen, tie_method = "first") genus_traits

Credits and required citations

traitscrape depends entirely on the availability and open architecture of the CoralTrait Database. Users must cite:

Madin, J. S., Anderson, K. D., Andreasen, M. H., Bridge, T. C. L., Cairns, S. D., Connolly, S. R., Darling, E. S., Díaz, M., Dornelas, M., Doughty, C., et al. (2016).
The Coral Trait Database. Scientific Data, 3, 160017.
https://doi.org/10.1038/sdata.2016.17

Trait classifications for life history strategy derive from:

Darling, E. S., Alvarez-Filip, L., Oliver, T. A., McClanahan, T. R., & Côté, I. M. (2012).
Evaluating life-history strategies of reef corals using species traits. Ecology Letters, 15(12), 1378–1386.
https://doi.org/10.1111/j.1461-0248.2012.01861.x

Please include both citations in any publications making use of traitscrape outputs.

Authors and versioning

This Zenodo archive represents version v0.1.0, corresponding to the initial public beta release. The intention is to support reproducibility for coral demographic and trait-based studies across the globe.

Files

dohertyml/traitscrape-v.0.1.1.zip

Files (100.1 kB)

Name Size Download all
md5:c763496e7371a807071746b8230a2c1c
11.4 kB Preview Download
md5:ddd99e2a3a7234079be06ba10d5e93e6
88.8 kB Preview Download

Additional details

Related works