R resources

Tutorial – Manipulating and analyzing spatial data in R

This tutorial provides an introduction to the manage and analysis of spatial data in R. It requires basic knowledge of R.

Tutorial.pdf                                                   data.zip


R scripts

This section provides some R scripts related to articles presented on the Publications page. A short description of each script is provided and a description of inputs required. Sample input files are also provided.

These scripts are provided without any guarantee. Do not hesitate to propose some comments or improvements.

1. Assessing the performance of protected area networks in representing a regional species pool

It computes the number of taxa represented in a reserve network for a given conservation target and assesses whether this level of representation is significantly lower or greater than expected by chance. An analysis for multiple thresholds to consider a grid cell as protected is undertaken. The inputs are: (1) matrix of presence/absence data by species and area; (2) a table with area codes and the percentage of overlap with protected areas for each area.

gap_analysis.r                                 matrix.txt                                cells.txt

Citation and details:

Abellán P, Sánchez-Fernández D. 2015. A gap analysis comparing the effectiveness of Natura 2000 and national protected area networks in representing European amphibians and reptiles. Biodiversity and Conservation 24: 1377-1390.


2. Assessing species’ representation in protected area networks

For each species, the level of representativeness in a protected area network is computed as the mean percentage of spatial overlap between those planning units in which the species occurs in the study area and the protected areas (grid cells). The inputs are: (1) matrix of presence/absence data by species and area; (2) a table with area codes and the percentage of overlap with protected areas for each area.

mean_percentage_overlap.r                                      matrix.txt                           cells.txt

Citation and details:

Sánchez-Fernández D, Abellán P. 2015. Using null models to identify under-represented species in protected areas: A case study using European amphibians and reptiles. Biological Conservation 184: 290–299.


3. Obtaining a species’ genetic landscape based on pairwise population genetic divergences

It obtains a genetic landscape based on pairwise population genetic divergence, as measured among multiple collection point locations, according the following procedure: (i) a network connecting all collection points to their nearest neighbours with non-overlapping edges is drawn; (ii) the midpoints between each connected edge are mapped, and values of genetic distances are attached to these points; (iii) a spatial interpolation algorithm, inverse distance weighted interpolation, is used to generate a surface from the mapped genetic distance values; and (iv) to avoid extrapolating beyond the spatial extent of collection points, the genetic landscape is clipped to the extent of the original network (sampling extent) and to the boundaries of the region of analysis.The inputs are: (1) table with locality codes and geographic coordinates; (2) pairwise matrix of genetic divergences between populations/localities; (3) study area mask raster.

genetic_landscape.r            locs.txt           gdist.txt        ip_mask.asc

Citation and details:

Abellán P, Svenning JC. 2104. Refugia within refugia– patterns in endemism and genetic divergence are linked to Late Quaternary climate stability in the Iberian Peninsula. Biological Journal of the Linnean Society 113: 13–28.


4. Assessing phylogenetic clustering in an assemblage in relation to a species pool

It tests phylogenetic clustering in an assemblage by assessing if its species are more closely related to each other than expected by chance. For this purpose, it calculates the mean phylogenetic distance (MPD) and mean nearest taxon phylogenetic distance (MNTD) and them compares them to MPD/MNTD values for 1,000 randomly generated samples of an equal number of species drawn without replacement from the list of all available species in the species pool. It can be run for multiple trees. The inputs are: (1) phylogenetic tree(s); (2) community matrix; (3) study area mask raster.

phylogenetic_bias.r                              tree.nex                               comm.txt

Citation and details:

Abellán P, Carrete M, Anadón JD, Cardador L, Tella JL. 2015. Non-random patterns and temporal trends (1912-2012) in the transport, introduction and establishment of exotic birds in Spain and Portugal. Diversity and Distributions, 22: 263-273.


5. Identifying which clades significantly contribute to the phylogenetic structure in an assemblage

For each node in the phylogeny, it is tested whether it has significantly more descendent taxa in a sample than would be expected by chance by means of a randomization test (equivalent to NODESIG function in Phylocom software). Observed patterns are compared to those from random draws of s taxa from the phylogeny terminals where s is the number of taxa in the sample.

Nodesig.r                              tree.nex                               comm.txt

Citation and details:

Abellán P, Carrete M, Anadón JD, Cardador L, Tella JL. 2015. Non-random patterns and temporal trends (1912-2012) in the transport, introduction and establishment of exotic birds in Spain and Portugal. Diversity and Distributions, 22: 263-273.

 

 

 

Advertisements