UPDATED 2023-08-10

Chapter numbers have changed, starting after Lotka-Volterra competition.

Updated original, but long absent, material on the competition-colonization tradeoff, extinction debt (sensu Tilman 1994), and especially the storage effect.

Later this fall, I may add a section on modern coexistence theory.

August 2022

These updates will include usual fixes for typos and incremental movement toward slightly practical application. I am trying to include slightly more material and code that students might actually use in their theses and dissertations. When I update the book, I will list below as many of the changes as I can, including

  • cleaning up and clarifying the integral projection example.
  • includes a simple discrete nonlinear density-dependent population growth model (Watkinson et al. 1980). Several studies evaluating modern coexistence theory and the invasion criterion of coexistence use extensions of this model.
  • I will soon add nonlinear density-dependent population growth model (Watkinson et al. 1980) into two species competition.

20 August 2021


  • Lotka-Volterra versions of direct competition AND mutualism are together in one chapter, followed by consumer-resource interactions, including predator-prey, and resource-based competition and mutualism.
  • a chapter on consumer-resource competition and mutualism that follows chapters covering two-species consumer resource interactions (mostly predator-prey).
  • If it has been > 1 y since looking at the primer package, you might want to peruse the index - I added a few more functions including ones for 1/f noise, spectral mimicry, and the Allee effect.

This is based on my book published with Springer, “A Primer of Ecology With R”, part of the Use R! series.

The primer package on CRAN (v. 1.2.0) should suffice for this edition. You may also install it directly from GitHub. To do this, install the devtools package. To successfully do that on a Windows operating system, I think you need to install Rtools:

Once you have done all that, use this code:


In spite of the presumptuous title, my goals for this book are modest. I wrote it as

  • the manual I wish I had in graduate school, and
  • a primer for our graduate course in Population and Community Ecology at Miami University.1


I am grateful for the generosity of early reviewers and readers, each of whom has contributed much to the quality of this work: Jeremy Ash, Tom Crist, David Gorchov, Raphael Herrera-Herrera, Thomas Petzoldt, James Vonesh, as well as several anonymous reviewers, and the students of our Population and Community Ecology class over the past 15 years. I am also grateful for the many conversations and emails shared with four wonderful mathematicians and theoreticians: Jayanth Banavar, Ben Bolker, Stephen Ellner, and Steve Wright — I never have a conversation with these people without learning something. I have been particularly fortunate to have team-taught Population and Community Ecology at Miami University with two wonderful scientists and educators, Davd Gorchov and Thomas Crist. Only with this experience, of working closely with these colleagues, have I been able to attempt this book. It should go without saying, but I will emphasis, that the mistakes in this book are mine, and there would be many more but for the sharp eyes and insightful minds of many other people.

More recently, Dr. Quan-Guo Zhang has kindly provided very helpful comments and corrections.

I am also deeply indebted to the R Core Development Team for creating, maintaining and pushing forward the R programming language and environment. Like the air I breathe, I cannot imagine my (professional) life without it. I am grateful to all of the developers of packages that have allowed literate programming with Rmarkdown and LaTeX, using RStudio and GitHub.

I am indebted to Rachel Collins for her size-structured coneflower data, to Scott Meiners and his colleagues for their generous sharing of data, metadata, and statistical summaries from the Buell-Small Succession Study ( I would like to thank Stephen Ellner for Ross’s Bombay death data and for R code and insight over the past few years. I am also indebted to Tom Crist and his colleagues for sharing some of their moth data (work supported by The Nature Conservancy Ecosystem Research Program NSF DEB-0235369).

Last, and most importantly, I would like to thank those of you in my life who make living worthwhile.

Martin Henry Hoffman Stevens

Oxford, OH, USA, Earth

Today, Current Era