R Code

R-code for calculating a diversity profile

Part of the Eectronic Supplementary Material for Leinster, T. & Cobbold C.A. Measuring diversity: the importance of species similarity.

The R-code allows the reader to plot a diversity profile using species similarity data and abundance data. As I am still learning R this is not the most elegant code and as I learn more I hope to improve it, but it does run! Download DiversityProfileExample.r. This code is written to reproduce example 3 from the paper that uses Butterfly data from DeVries et al (1997), you can modify the code to use your own data or the data from example 3 can be downloaded here: DeVriesAbundanceData.csv and DeVriesSimilarityMatrix.csv

thumb 1
thumb 2
thumb 3