Skip to content

Food webs

Food webs
Some of the R code used to study food webs…

  • Model food webs using random, cascade, or niche algorithms.
  • Plot a predation matrix of the food web.
  • Calculate structural properties of food webs.


  1. Learn how to use R(!)
  2. Get the code from here.
  3. Source the file FoodWebFunctions.r into R; it contains a bunch of food webby functions.
  4. Check out the code in FoodWebExamples.r for an example of how to use the functions.

(Neo Martinez and Alice Boit recently showed me Network 3D. This is just a note to remind myself to write some instructions and code that can help me and perhaps others to move between the data format I’ve been using to store food webs, and a format easily read by Network 3D. Note that the R package cheddar has a function for formatting data for Network 3D.)

A post about predation matrices, based on Owen’s contribution to a workshop at Intecol2013.