cran version downloads DOI


The EcoDiet package estimates a probabilistic topology matrix (all trophic link probabilities) and a diet matrix (all diet proportions) for food webs by combining biotracer and stomach content analyses in a Bayesian hierarchical model.

The full model and its application to a real dataset are described in Hernvann et al. (in press). When using EcoDiet, please cite both Hernvann et al. and the package (citation("EcoDiet")):

Hernvann, P. Y., Gascuel, D., Kopp, D., Robert, M., & Rivot, E. (2022). EcoDiet: A hierarchical Bayesian model to combine stomach, biotracer, and literature data into diet matrix estimation. Ecological Applications, 32(2), e2521.

Théro, H., Rivot, E., Robert, M., Guitton, J., Kopp, D., Gascuel, D., et Hernvann, P.Y. (2020) EcoDiet. R package. doi: 10.5281/zenodo.4081537

To access the citation and DOI of the latest development version, check the Zenodo repository

Recent updates: The latest updates of the EcoDiet package (> v 2.0.0) include major differences with the original version (v 1.). Please read the NEWS file for more details.

Using EcoDiet

R installation

EcoDiet is a R package so, first and foremost, you should download and install/update R.

JAGS installation

EcoDiet relies on the JAGS software, so you also need to download and install/update JAGS. You should install the last version of JAGS so that your model will run at maximal speed.

For Windows users

Download JAGS from here, then follow the indications.

For MacOS and Linux users

Try this command if you are on MacOS:

sudo brew update
sudo brew install jags

or this command if you are on Linux:

sudo apt-get update
sudo apt-get install jags

If you get an error message during installation, check this post from Yu-Sung Su’s blog.

EcoDiet installation

To download the EcoDiet package from GitHub, you need to use the install_github function from the devtools package to load it. First, install the devtools package:

{r, eval = FALSE} install.packages("devtools")

Once devtools has been installed, you can load the EcoDiet package:

{r, eval = FALSE} devtools::install_github("pyhernvann/EcoDiet", build_vignettes = TRUE, dependencies = TRUE)

Since the 6th of May 2020 EcoDiet is also available on the CRAN. You can directly install it from R and load it:

```{r, eval = FALSE} install.packages(“EcoDiet”)


### Learn how to use EcoDiet

Several vignettes explain how to use the package. Run the following in R and click on the HTML button next to "1. Introduction - How to use EcoDiet":


Or use this if the former does not work:

vignette(“introduction_EcoDiet”) ```