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

To install the latest version of the primer R package, 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.

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

  1. Miami University is located in the Miami River valley in Oxford, Ohio, USA; the region is home to the Myaamia tribe that dwelled here prior to European occupation.↩︎