Scaling the effects of size and temperature on animal consumption rates from individuals to populations in a subtropical reef fish
This repository contains code and data needed to reproduce the article:
Zaú PNS, Ferreira CEL, Fagundes Netto EB, Mendes TC, Barneche DR (2025) Scaling the effects of size and temperature on animal consumption rates from individuals to populations in a subtropical reef fish. Functional Ecology.
When using the data or code from this project, please cite it as:
Zaú PNS, Ferreira CEL, Fagundes Netto EB, Mendes TC, Barneche DR (2025) Data for: "Scaling the effects of size and temperature on animal consumption rates from individuals to populations in a subtropical reef fish". Data available in https://figshare.com/s/f390cb6aa1103daf64b6.
How to download this project for people not familiar with GitHub:
on the project main page on GitHub, click on the green button Code and then
click on Download ZIP.
All analyses were done in R. This routine uses the
targets R package to wrangle the data,
run the Bayesian model, and create all figures and table. First install
targets:
install.packages("targets")Next you need to open an R session with working directory set to the root of the project.
This routine uses some packages detailed under _targets.R, so make sure to install them before running anything.
Then, to reproduce all targets, run:
source("run.R") # this may take several hours to a dayOnce all targets have been created, you can also reproduce the general
statistics reported in the paper by running code from main_text_stats.R.
Disclaimer: The model output presented in the paper can be fully replicated via Docker. While that guarantees perpetuity of software versioning, we warn that different hardware may produce slightly different outputs (e.g., parameter estimates might differ by a few decimal places), particularly when it comes to our Bayesian model. The statistics presented in our manuscript were generated using the container described below, running on a MacBook Pro 2021 (Apple M1 Max chip, 64 Gb memory, MacOS Ventura version 13.4 [22F66]).
First of all, you need to download and install Docker on your machine. This is the software that provides the tools for you to run your own container. Once you finished installing it, open the software which will contain OS-specific examples on how to build Docker images. There are many online help pages available of you need help understanding Docker.
Then you can reproduce our stats by pulling a built image from dockerhub:
docker pull dbarneche/scacri
Note that the full image is a few Gb in size, and OS other than Mac OS
(running on Mx processors) will need to build the image from scratch. If that
is your case, simply use our Dockerfile locally:
docker build . --tag scacri -f Dockerfile
Then run the container interactively; the code below mounts the container onto your local path---so, make sure your local path is pointing to the root directory of our repository.
docker run --rm -v "`pwd`":/home/Project -it --entrypoint /bin/bash scacri
Rscript -e "source('run.R')"
The running Docker container above uses the following software and associated packages:
R version 4.2.2 (2022-10-31)
Platform: aarch64-unknown-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS
Matrix products: default
BLAS: /usr/lib/aarch64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rerddap_1.0.1 brms_2.18.0 Rcpp_1.0.9 HDInterval_0.2.4
[5] lubridate_1.9.0 timechange_0.1.1 ggdist_3.2.0 tarchetypes_0.7.3
[9] targets_0.14.1 patchwork_1.1.2 forcats_0.5.2 stringr_1.5.0
[13] dplyr_1.0.10 purrr_1.0.0 readr_2.1.3 tidyr_1.2.1
[17] tibble_3.1.8 ggplot2_3.4.0 tidyverse_1.3.2
loaded via a namespace (and not attached):
[1] readxl_1.4.1 backports_1.4.1 plyr_1.8.8
[4] igraph_1.3.5 crosstalk_1.2.0 listenv_0.9.0
[7] rstantools_2.2.0 inline_0.3.19 digest_0.6.31
[10] htmltools_0.5.4 fansi_1.0.3 magrittr_2.0.3
[13] checkmate_2.1.0 base64url_1.4 googlesheets4_1.0.1
[16] tzdb_0.3.0 globals_0.16.2 modelr_0.1.10
[19] RcppParallel_5.1.5 matrixStats_0.63.0 xts_0.12.2
[22] prettyunits_1.1.1 colorspace_2.0-3 rvest_1.0.3
[25] rappdirs_0.3.3 hoardr_0.5.2 haven_2.5.1
[28] xfun_0.36 callr_3.7.3 crayon_1.5.2
[31] jsonlite_1.8.4 zoo_1.8-11 glue_1.6.2
[34] gtable_0.3.1 gargle_1.2.1 distributional_0.3.1
[37] pkgbuild_1.4.0 rstan_2.21.7 abind_1.4-5
[40] scales_1.2.1 mvtnorm_1.1-3 DBI_1.1.3
[43] miniUI_0.1.1.1 xtable_1.8-4 stats4_4.2.2
[46] StanHeaders_2.21.0-7 DT_0.26 htmlwidgets_1.6.0
[49] httr_1.4.4 threejs_0.3.3 posterior_1.3.1
[52] ellipsis_0.3.2 pkgconfig_2.0.3 loo_2.5.1
[55] farver_2.1.1 dbplyr_2.2.1 utf8_1.2.2
[58] crul_1.3 tidyselect_1.2.0 rlang_1.0.6
[61] reshape2_1.4.4 later_1.3.0 munsell_0.5.0
[64] cellranger_1.1.0 tools_4.2.2 cli_3.5.0
[67] generics_0.1.3 broom_1.0.2 fastmap_1.1.0
[70] yaml_2.3.6 processx_3.8.0 knitr_1.41
[73] fs_1.5.2 ncdf4_1.20 future_1.30.0
[76] nlme_3.1-160 mime_0.12 xml2_1.3.3
[79] compiler_4.2.2 bayesplot_1.10.0 shinythemes_1.2.0
[82] curl_4.3.3 reprex_2.0.2 stringi_1.7.8
[85] ps_1.7.2 Brobdingnag_1.2-9 lattice_0.20-45
[88] Matrix_1.5-1 markdown_1.4 shinyjs_2.1.0
[91] tensorA_0.36.2 vctrs_0.5.1 pillar_1.8.1
[94] lifecycle_1.0.3 furrr_0.3.1 bridgesampling_1.1-2
[97] data.table_1.14.6 httpuv_1.6.7 R6_2.5.1
[100] promises_1.2.0.1 gridExtra_2.3 parallelly_1.33.0
[103] codetools_0.2-18 colourpicker_1.2.0 gtools_3.9.4
[106] assertthat_0.2.1 withr_2.5.0 httpcode_0.3.0
[109] shinystan_2.6.0 parallel_4.2.2 hms_1.1.2
[112] grid_4.2.2 coda_0.19-4 googledrive_2.0.0
[115] shiny_1.7.4 base64enc_0.1-3 dygraphs_1.1.1.6
This repository is provided by the authors under the CC BY 4.0 license.
Please report any issues or bugs.