Introductory lesson to generate range maps for butterfly-host plant interactions and predict distributional shifts using publicly available biodiversity data and data science tools
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
dev
docs
functions
img
output
scripts
.gitignore
LICENSE.txt
README.md
ebutterfly-sdm.Rproj

README.md

Lesson on biodiversity data and species distribution models

v0.9.3

Overview

Introductory lesson to generate range maps for butterfly-host plant interactions and predict distributional shifts using publicly available biodiversity data and data science tools.

Detailed instructions can be found in docs/instructions.md

Originally forked from https://github.com/jcoliver/ebutterfly-sdm.git

Dependencies

Five additional R packages are required (these will be installed by running the the setup script, scripts/setup.R):

  • raster
  • sp
  • dismo
  • maptools

Structure

  • data
    • wc2-5: climate data at 2.5 minute resolution from WorldClim (note: this folder is not under version control, but will be created by running the setup script (scripts/setup.R))
    • cmip5: forcast climate data at 2.5 minute resolution from WorldClim (note: this folder is not under version control, but will be created by running the setup script (scripts/setup.R))
    • Adelpha_californica_data.csv: data harvested from iNaturalist for Adelpha californica (Lepidoptera: Nymphalidae)
    • Lycaena_xanthoides_data.csv: data harvested from iNaturalist for Lycaena xanthoides (Lepidoptera: Lycaenidae)
    • Papilio_cresphontes_data.csv: data harvested from iNaturalist for Papilio cresphontes (Lepidoptera: Papilionidae)
    • Quercus_chrysolepis_data.csv: data harvested from iNaturalist for Quercus chrysolepus (Fagales: Fagaceae)
    • Rumex_salicifolius_data.csv: data harvested from iNaturalist for Rumex salicifolius (Caryophyllales: Polygonaceae)
    • Zanthoxylum_americanum_data.csv: data harvested from iNaturalist for Zanthoxylum americanum (Sapindales: Rutaceae)
  • dev: developmental scripts for example images
  • docs: documentation for this code and lesson
    • instructions.md: instructions for installing software, downloading data, and running analyses
    • script-explanation.md: explanations of the four species distribution modeling scripts (all prefixed with "run-*") in the scripts folder
    • troubleshooting.md: common challenges and possible solutions related to installing software and running analyses
  • functions
    • sdm-functions.R: functions used in species distribution models
  • img: images for Instructions
  • output (contents are not under version control)
  • scripts (The Script Explanation page provides more in-depth explanations of the species distribution modeling scripts)
    • examples: example scripts implementing the four run-* scripts and two plot-* scripts
    • get-observation-data.R: Harvest data from iNaturalist using their API based on a taxon ID; called from command line terminal
      • Usage: Rscript --vanilla get-observation-data.R <taxon_id>
      • Example: Rscript --vanilla get-observation-data.R 60606
    • plot-observations.R: Template to plot observations on a map
    • plot-six-panel.R: Template to generate species distribution models for a pair of species (generally, an insect and host plant) and create a six panel plot with the following panels: (1) Observations of species one (e.g. an insect), (2) observations of species two (e.g. a plant), (3) contemporary species distribution model for species one, (4) contemporary species distribution model for species two, (5) contemporary species distribution models of species one and two, showing areas of difference and overlap, (6) forecast species distribution models of species one and two, showing areas of difference and overlap
    • run-future-sdm-pairwise.R: Template to run species distribution model for an insect and its host plant species based on forecast climate model
    • run-future-sdm-single.R: Template to run species distribution model for a single species based on forecast climate model
    • run-sdm-pairwise.R: Template to run species distribution model for an insect and its host plant species based on current climate data
    • run-sdm-single.R: Template to run species distribution model for a single species based on current climate data
    • setup.R: Setup script to run at start of project, it will:
      • Install five additional R packages that are necessary for this lesson (rgdal, raster, sp, dismo, maptools)
      • Check to make sure the data folder was copied correctly during the cloning of the GitHub repository
      • Download climate data from the WorldClim website If it does not successfully complete all these tasks, please reference the Troubleshooting page.

Resources

Species distribution models in R

iNaturalist