Tuesday, February 10, 2015

Biodiversity mapping functions for R (1): Weighted Endemism (raw)



Weighted Endemism

I am sequentially posting some self-contained functions for mapping biodiversity metrics in R.

When I began a project producing regional biodiversity maps from a large inventory dataset, I wanted to stay in R for its seamless data processing and downstream modelling and analysis capabilities. The ‘Biodiverse’ software package [see https://code.google.com/p/biodiverse/] already has a large range of biodiversity mapping applications, but as far as I know there were previously no self-contained applications in R for what I needed to do.


Long story short, to do the analysis I wanted in R and with some alternative implementations, I had to code it from scratch (building on functionality such as in package ‘raster’). From this I have developed some self-contained and open-source functions for general use.


Additional options can be incorporated, such as moving window analysis, down-scaling etc, using functions in ‘raster’. I am also working towards integration with other site-based biodiversity estimation functions in R (i.e. to start with incidence data and output rasters and associated data).


The first function here is:


weighted.endemism.R [full code at https://raw.githubusercontent.com/GregGuerin/biomap/master/weighted.endemism.R]:

Update: there is now an associated article: Guerin, G.R., Ruokolainen, L. & Lowe, A.J. (2015) A georeferenced implementation of weighted endemism. Methods in Ecology and Evolution. DOI: 10.1111/2041-210X.12361


Description --Calculates weighted endemism (species richness inversely weighted by species ranges) across gridded maps using single or site-based point records.


Details --This implementation of weighted endemism allows alternative calculation of weights for species ranges as well as the option of user-supplied weights. Weights can be calculated based on the frequency of occurrence in grid cells, or alternatively by the geographical size of the species range, calculated in one (span) or two (area) dimensions.


Usage -- An example: 


require(vegan)

data(mite)
data(mite.xy)
endemism_mydata <- weighted.endemism(mite, site.coords = mite.xy, records="site")

No comments:

Post a Comment