A function that takes individual species thermal indices (STIs) and their abundances, and partitions their contributions to the change in the community thermal index through at least two time points.
example <- data.frame(
site = "site1",
date = c(rep(as.Date("2001-01-01"), 5), rep(as.Date("2002-01-01"), 5)),
species = paste0("species", LETTERS[1:5]),
STI = c(21.2, 23.4, 19.2, 26.1, 22.0),
abundance = c(0, 0, 10, 8, 3, 1, 3, 5, 0, 0)
)