R codes

Here are a few R functions which I have written and used in past papers.  Please refer to the original papers for further explanations, citations and context. You are welcome to use, criticize, correct and improve them, but if you do, please send me some feedback and acknowledge your source of inspiration.

Trait range filtering within communities (github link)

Function testing whether trait ranges within communities are narrower than expected given the metacommunity species pool and local community species richness. Null expectations are obtained with a lottery-type null model which randomly assembles species from the species pool into null communities of a given species richness, the probability of drawing a species being proportional to its abundance in the metacommunity.

See application : Bernard-Verdier, M., Navas, M., Vellend, M., Violle, C., Fayolle, A., & Garnier, E. (2012). Community assembly along a soil depth gradient : contrasting patterns of plant trait convergence and divergence in a Mediterranean rangeland. Journal of Ecology, 100(6), 1422–1433.

Trait variance and other moments within communities (github link)

Function calculating the four abundance-weighted moments (mean, variance, skewness, kurtosis) of a trait distribution within communities, and comparing each moment against a null model shuffling abundances within communities.

See application in: Bernard-Verdier, M., Navas, M., Vellend, M., Violle, C., Fayolle, A., & Garnier, E. (2012). Community assembly along a soil depth gradient : contrasting patterns of plant trait convergence and divergence in a Mediterranean rangeland. Journal of Ecology, 100(6), 1422–1433.

Functional and phylogenetic divergence within communities (Rao’s quadratic entropy) (alphaRao.test.R)

Function calculating functional (alphaFD) and/or phylogenetic (alphaPD) divergences within communities using Rao’s Quadratic entropy and testing observed values against a null model shuffling abundances among species within each community.

See application in : Bernard-Verdier, M., Flores, O., Navas, M.-L., & Garnier, E. (2013). Partitioning phylogenetic and functional diversity into alpha and beta components along an environmental gradient in a Mediterranean rangeland. Journal of Vegetation Science, 24(5), 877–889.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s