SDI: Sexual dimorphism index.

View source: R/summary_stats.R

SDIR Documentation

Sexual dimorphism index.

Description

Calculates the sexual dimorphism index of Lovich & Gibbons (1992): (larger sex / smaller sex) - 1 and arbitrarily made positive when females are the larger sex or negative when males are the larger sex.

Usage

SDI(t, dfin)

Arguments

t

Character object naming a trait in dfin.

dfin

Data frame which must contain at least three columns: one containing trait names that match t, a column with female measurements that must match "female" exactly, and a column with male measurements that must match "male" exactly.

Value

A numeric representing the calculated sexual dimorphism index for trait t.

Author(s)

matthewwolak@gmail.com

References

Lovich, JE & Gibbons, JW. 1992. A review of techniques for quantifying sexual size dimorphism. Growth, Development, and Ageing 56(4):269-281.

Examples

popDat <- data.frame(trait = c("length", "weight", "coloration", "intelligence"),
   female = c(4.2, 255.0, 0.57, 144),
   male = c(3.7, 255.0, 0.89, 143))
SDI("length", popDat)
sapply(popDat$trait, FUN = SDI, dfin = popDat)
stopifnot(SDI("weight", popDat) == 0.0)

matthewwolak/wolakR documentation built on May 10, 2023, 1:27 p.m.