Methodological Workshop On Biodiversity Dynamics

This page gives the code and instructions for Nick Matzke's R-and-Biogeography workshop session at the "Methodological Workshop On Biodiversity Dynamics", on May 26 at the SI meeting "Evolution of Life on Pacific Islands and Reefs: Past, present, and future"

In the workshop, I gave 2 demos:

  1. A simple example of a maximum likelihood search for estimating the relative probability of lineages changing geographic range, precipitation preference, and elevation preference
  2. A demo showing how GIS, GBIF, and phylogenetics can be integrated in R.

These were both meant as "for instance" demos, to give users a taste of what you can do with R, and, hopefully, the ability to get the basic code running themselves. They are not meant to be complete analyses by themselves.

Please contact Nick Matzke ( for questions/comments/collaborations.

Background in R

R is a free download, available here:

If you are starting R totally from scratch, I recommend the tutorial I wrote for U.C. Berkeley's IB200B: Phylogenetics - Ecology & Evolution course.

In particular, the Feb. 3 lab, "Introduction to R". See the R books and files linked from there. For the code, go to: LAB #3: Introduction to R.

Demo #1: ML search for relative probability of lineage changing geographic zone, precipitation zone, and elevation zone (3 binary, discrete categories)

The script is: _biogeog_workshop_ML_search_v2.R. There are no necessary files except the utility scripts, which can be remotely sourced (shown in the script) or downloaded from here:

Demo #2: Integrating GIS, GBIF, and phylogenetics

The script is: _biogeog_workshop_GIS_v4.R. Getting it to work requires:

  1. Installing the GDAL library on your computer (see/use: _biogeog_workshop_GIS_v3_installation.R)
  2. Installing the RGDAL package in R (see/use: _biogeog_workshop_GIS_v3_installation.R)
  3. Downloading the GIS data files from here:
  4. Setting the R working directory (command: setwd("directory_string_here") ) so that R sees your data files.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License