Here I've compiled a list of resources for learning the open source statistical software package R. I often find myself reading about models and thinking, 'That seems great, but how hard is it to actually do that?' So I've decided to maintain a list of resources related to analyses that I've worked on in case anyone else is interested in learning about them. Suggestions are encouraged (email me).

[ Open All | Close All ]

Introductions to R

With an ecological focus


General

  • icebreakeR. A clearly written and complete medium-length tutorial.

  • CRAN's Introduction to R. Example driven and slightly technical list of introductory materials; a nice table of contents for quick searches.

  • R for beginners. 75 page tutorial including basics, data entry, graphics, anova and loops.

  • R reference card. A four page list of useful functions.

  • R graph gallery. REALLY COOL GRAPHICS. I always show this to new R users as motivation for learning R and visualizing models. All the code for each plot is provided, and it's often surprisingly simple.

  • A Beginner's Guide to R. A full book, available for free download at some universities.

  • Quick-R. A very succinct guide for a handful of standard analyses. Nicely demonstrates how simply some analyses can be coded.

  • Resources from a fairly comprehensive online course offered by USGS

  • Various basic short tutorials. They won't get you too far, but they are nice and clear and can be good for teaching examples.1, 2, 3

  • A set of links to >20 tutorials from various universities, kindly compiled by economist Pairach Piboonrungroj

General Ecology with R

Integral Projection Models

  • Our IPM Guide has a 200 page appendix (yes, really) full of tutorials

  • Our range modeling paper based on IPMs has lengthy appendix demonstrating all calculations.

  • IPMpack. An R package for building IPMs. Many resources available on the homepage, including a help forum.

  • A software note explaining IPMpack in MEE.

  • Notes from a workshop we ran at ESA in 2013.

  • Nicely documented code from Steve Ellner and colleagues published as Easterling et al. 2000 and Ellner and Rees 2006

  • Vindenes et al 2011 provide code for three examples that incorporates demographic stochasiticity. Supplement

Bayesian Modeling

General Bayesian Resources

  • The CRAN Taskview. Listing all the packages containing functions useful for Bayesian modeling.

  • spBayes course. Notes and code from a course on spBayes developed by Sudipto Banerjee and Andy Finley.

  • Bayesian Computation with R. A full book, available for free download at some universities. This is very introductory and relies heavily on a suite of specialized functions written for the book. On the plus side, it's comprehensive and explains everything thoroughly if you want to read it cover to cover. It's a fine if you're just beginning and would like a very gentle start but doesn't leave you ready to write your own models.

  • An Introduction to Probability Simulations and Gibbs Sampling with R. A full book, available for free download at some universities.

  • Introducing Monte Carlo Methods with R. A full book, available for free download at some universities.

JAGS

  • Using JAGS with R. JAGS is Gibbs sampling software that uses the BUGS language (like WinBUGS and OpenBUGS; see user manual). JAGS is the easiest to get running on a Mac, which is why I use it, and it is designed to communicate nicely with R. There are two ways to run JAGS from R: (1) the rjags package, created by the developer of JAGS, and (2) the R2JAGS package, developed to work like the R2BUGS package that PC users have for WinBUGS. Here are a few sets of slides on what JAGS is all about: 1, 2. The following represents the some good and basic starting code that I found useful:

  • rjags

  • A complete tutorial with examples: An Ecological Modeler's Primer on JAGS

    Normal model and regression examples

  • Most BUGS code (from WinBUGS or OpenBUGS) can be run in JAGS without any modifications. Here are some useful resources for BUGS Code

  • Code for a handful of very basic models; a great starting point.

    A large range of WinBUGS Examples Vol1.pdf and Vol2.pdf, distributed with WinBUGS.

Species Distribution Modeling (SDMs)

  • hSDM- A package for building spatially explicit hierarchical Bayesian SDMs. We're currently working on a vignette.

  • biomod2 - A package for building SDMs using a number of algorithms simultaneously, and is well suited for ensemble modeling

  • dismo, SDMTools - Packages which seem to have a lot of useful features, but which I don't know very well at the moment.

  • A series of presentations and example code from a workshop I participated in at the American Museum of Natural History in February 2013. Topics include getting and cleaning data, managing spatial data, niche overlap, cool plotting, and parallel computing. This contains some introductory material, so is surely useful for beginners who'd like to see sample analyses, but also includes some flashy stuff.

Maximum Entropy

There isn't a whole lot out there for maximum entropy models in ecology or in R (note that I distinguish between 'maximum entropy models', which could describe any model based on maximizing the entropy of somethingorother, and the shorthand 'Maxent,' which is a popular species distribution modeling software. Entropy models are typical in other fields such as physics, computer science and natural language processing, where different computational tools are used. Entropy modeling in ecology is growing rapidly (in my opinion anyways), but because it is somewhat limited presently, this represents a nearly exhaustive list. You may find other entropy-related topics in R, but these are typically used for measuring different attributes of probability distributions and are not actual maximum entropy models.

General Maximum Entropy Models

  • The FD package contains functions to solve a maximum entropy problem and provide significance tests for the results. These functions are general and could be used for an arbitrary maximum entropy model, but they were designed for trait-based models for communities and are easiest to use for that application.

  • The supplement from my paper on using a maximum entropy model to predict community relative abundance along ecological gradients based on functional traits.

  • The np package uses entropy-based measures to compare probability distributions. This is potentially useful for comparing the results of maximum entropy models to one another.

Maxent

  • The dismo package provides an R interface for the species distribution modeling software Maxent. I haven't actually tinkered with it to see how well it works, but I've heard good reviews.

  • Maxent can be called from R by passing commands to the terminal using the function system().

Cellular Automata

  • The supplement from one of my papers on distribution modeling (pdf) contains some example code (Appendix 4) to build a CA model from scratch. It's a bit clunky because I wrote it when I was just starting with R, but it's simple and tolerably succinct.

  • The MigClim package seems to build similar models to my CA model in Am Nat, but theirs is more more flexible and user-friendly.

  • The simecol package has tools for CA models, although I haven't tinkered around with it enough to provide an evaluation.

Miscellaneous