This document is a work in progress, please give us feedback

1 Data

In this tutorial we are going to work with the order of mammals Hyracoidea commonly known as Hyraxes

2 Extracting the IUCN status for each species

The R package taxize allows us to extract the IUCN status automatically. However, the functions of this package require an API key. Get the key at http://apiv3.iucnredlist.org/api/v3/token, and pass it to the key parameter, or store in your .Renviron file like IUCN_REDLIST_KEY=yourkey

The function iucn_summary in the taxize package requires as an input the binomial name of the species

##               Binomial iucn
## 1 Dendrohyrax arboreus   LC
## 2 Dendrohyrax dorsalis   LC
## 3   Heterohyrax brucei   LC
## 4    Procavia capensis   LC

4 WWF terrestrial biomes and ecoregions data

The terrestrial ecoregions of the world (TEOW) from the World Wild Fund (WWF) represent a biogeographic framework to map earth’s biodiversity. This framework is mainly based on the publication by Olson et al., 2001.

Olson, D. M., Dinerstein, E., Wikramanayake, E. D., Burgess, N. D., Powell, G. V. N., Underwood, E. C., D’Amico, J. A., Itoua, I., Strand, H. E., Morrison, J. C., Loucks, C. J., Allnutt, T. F., Ricketts, T. H., Kura, Y., Lamoreux, J. F., Wettengel, W. W., Hedao, P., Kassem, K. R. 2001. Terrestrial ecoregions of the world: a new map of life on Earth. Bioscience 51(11):933-938

This biogeographic regionalisation consists of 867 terrestrial ecoregions, classified into 14 biomes and eight realms.

4.1 Download the WWF ecoregions data

To access these maps, you can either download the data from the WWF website or through the function WwfLoad() from the R package speciesgeocodeR

To use the WwfLoad() function, you only need to specify the directory path where you want the data to be store.

The WWF ecoregions are stored in a vector format, which represent discrete geometric locations (x,y values) known as vertices that define the shape of the spatial objects (e.g., points, lines and polygons). Here, the ecoregions and biomes are represented by spatial polygons which are usually stored in shapefiles. There are several functions in R that allows you to read shapefiles. One is using the function shapefile from the raster package or the readOGR function from the rgdal package

## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/echeverrialondono1/Desktop/Loops_shapefile/data/spatial/WWF_ecoregions/official", layer: "wwf_terr_ecos"
## with 14458 features
## It has 21 fields

ATTENTION: Please include the path of the directory where you store your spatial data into the .gitignore file to avoid problems with Github when you push your commits!

Like rasters, shapefiles are geospatial objects, and therefore they also include spatial data attributes such as Coordinate Reference System (CRS) and extent

## [1] "SpatialPolygonsDataFrame"
## attr(,"package")
## [1] "sp"
## CRS arguments:
##  +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
## class       : Extent 
## xmin        : -180 
## xmax        : 180 
## ymin        : -89.89197 
## ymax        : 83.62313

4.2 Extract information from the Spatial polygons

In this exercise, we want to extract the information about the realms and biomes that fall on each of our species occurrences. To do that, we first need to convert our occurrence data into a spatial data frame, and second, we need to make sure our spatial data frame has the same projection and coordinate system as the spatial polygons.

Now we can extract the information using the function over from the sp r package. This function overlay the ecoregions and biomes polygons on our spatial data frame and then retrieves the attributes for each occurrence.

lat lon fullCountry REALM BIOME G200_REGIO
-1.357095 36.71865 Kenya AT 7 East African Acacia Savannas
-1.356291 36.71974 Kenya AT 7 East African Acacia Savannas
0.003221 36.94571 Kenya AT 7 East African Acacia Savannas
-1.426575 35.07104 Kenya AT 7 East African Acacia Savannas
-5.074732 38.70292 Tanzania, United Republic of AT 1 Eastern Arc Montane Forests
-1.336434 36.77759 Kenya AT 7 East African Acacia Savannas

As you can see, the BIOMES levels are represented by numbers. To look at the numbers equivalence, we need to check the metadata of the WWF biomes. In our example, 7 represents Tropical & Subtropical Grasslands, Savannas & Shrublands. and 1 Tropical & Subtropical Moist Broadleaf Forests. In the metadata, you can also check the meaning of each REALM abbreviation (e.g., AT is equivalent to Afrotropics).