View source: R/summary_stats.R
SDI | R Documentation |
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.
SDI(t, dfin)
t |
Character object naming a trait in |
dfin |
Data frame which must contain at least three columns: one
containing trait names that match |
A numeric representing the calculated sexual dimorphism index for
trait t
.
Lovich, JE & Gibbons, JW. 1992. A review of techniques for quantifying sexual size dimorphism. Growth, Development, and Ageing 56(4):269-281.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.