This page is restricted.
Please enter the access password.
Morphological trait analysis toolkit for freshwater fish — from landmarks to intraspecific variability.
intraitR is a toolkit for the analysis of morphological traits in freshwater fish, from raw
two-dimensional landmark digitization to derived morphological ratios, shape space and functional trait
space. Building on the geometric-morphometric framework of
geomorph, it adds fish-specific
conveniences for ecomorphological analyses: import of landmark data from tpsDig files or
generic spreadsheets, Generalised Procrustes Analysis, classical linear ratios of fish ecomorphology,
construction and visualisation of morphological and functional trait spaces, quantification of
intraspecific morphological variability (ITV), and estimation of
measurement error from replicated digitization (Bailey & Byrnes 1990; Fruciano 2016).
It also implements the 11-measurement / 9-ratio digitization protocol of the FISHMORPH database (Brosse et al. 2021), whose database-level tools now live in the companion package Rfishmorph.
load_t26_saudrune(), demo("pipeline_T26_saudrune")).
The package is hosted on GitHub (not yet on CRAN). It requires geomorph (CRAN) and
Rfishmorph (installed automatically from GitHub via the Remotes field).
# install.packages("remotes")
install.packages("geomorph")
remotes::install_github("FunTraits/intraitR")
library(intraitR)
read_tps() (tpsDig), read_landmarks_csv()
(long format), read_landmarks_xlsx() (wide spreadsheets, one X/Y column pair per landmark), or
digitize photographs directly with the Shiny app digitize_landmarks() (see below).impute_landmarks()), enforce a head-left / belly-down frame (standardize_orientation()),
audit and snap landmarks to the protocol's geometric conventions (correct_landmarks(),
correct_geometry()), screen outliers (detect_outliers()). Every correction is recorded
in an audit-trail attribute.gpa_fish(); optional allometric
correction with correct_allometry().linear_distances()), ecomorphological
ratios (morpho_ratios()) or the FISHMORPH segments and ratios
(fishmorph_segments(), fishmorph_ratios()).shape_space()) and functional trait space
(trait_space(), PCA/PCoA with log10(x+1) + scaling, missing-value strategies up to
missForest), with spider / hull / density displays; project specimens into the global FISHMORPH
morphospace (project_fishmorph()).itv_index()), intraspecific_variability(), repeatability
(measurement_error()), landmark-level operator bias (digitization_error()),
and how ITV inflates functional richness (bootstrap_functional_space(),
compare_functional_richness()).fish <- load_t26_saudrune_landmarks()
fish_imputed <- impute_landmarks(fish)
fish_oriented <- standardize_orientation(fish_imputed)
fish_fixed <- correct_geometry(fish_oriented)
segments <- fishmorph_segments(fish_fixed)
ratios <- fishmorph_ratios(segments)
fts <- trait_space(ratios, groups = fish$metadata$species,
na_action = "omit", remove_outliers = TRUE)
plot(fts) # spider / ellipse display per species
itv <- itv_index(ratios, species = fish$metadata$species)
plot(itv)
digitize_landmarks() opens a bundled Shiny application: from a few calibration clicks, a trained
ml-morph model proposes the 19 FISHMORPH anatomical landmarks on each photograph, which the operator
reviews, corrects and exports. Every placement is written to an append-only journal, so a workbook can be rebuilt
after a crash (consolidate_landmarks()), and photographs are identified by content hash
(photo_hash()) rather than by file name.
| Family | Main functions |
|---|---|
| Landmark import & digitization | read_tps() read_landmarks_csv() read_landmarks_xlsx()
read_mlmorph_landmarks() digitize_landmarks() consolidate_landmarks()
plot_landmarks() |
| Superimposition & shape | impute_landmarks() standardize_orientation() correct_landmarks()
correct_geometry() gpa_fish() correct_allometry()
detect_outliers() |
| Morphometric traits & ratios | linear_distances() morpho_ratios() fishmorph_segments()
fishmorph_ratios() plot_fishmorph_points() plot_fishmorph_density() |
| Functional & shape space | trait_space() shape_space() project_fishmorph()
plotly_fishmorph() trait_disparity() tpd_dissimilarity()
bootstrap_functional_space() species_sensitivity()
compare_functional_richness() |
| Phylogenetic data & ordination | load_fishmorph_phylogeny() load_fishmorph_phylo_axes() phylo_pcoa() |
| Intraspecific variability & measurement error | itv_index() intraspecific_variability() itv_accumulation()
fd_accumulation() measurement_error() digitization_error()
operator_disagreement() summary_traits() |
| Example data | load_t26_saudrune() load_t26_saudrune_landmarks()
simulate_fish_landmarks() simulate_fishmorph_points() |
intraitR-intro): obtaining landmark data ·
Generalised Procrustes Analysis · linear distances and ratios · shape space · intraspecific morphological
variability · measurement error · allometry correction · the FISHMORPH protocol.demo("pipeline_T26_saudrune", package = "intraitR").citation("intraitR")