DOI: 10.6084/m9.figshare.24158340.v1
title: Code and data to reproduce "Linking geographic distribution and niche through estimation of niche density"

description: Code to reproduce the analyses from: Dallas,T, and C Ten Caten. 2025. Linking geographic distribution and niche through estimation of niche density. Journal of Animal Ecology. Code is written in R and the file is in R markdown (.Rmd). The Rdata file included (<code>env.RData</code>) contains the environmental data layers used, but code to recreate these layers is also included in the <code>analysis.Rmd</code> (keep in mind that it will take some time and processing power). <code>redlist_simple_summary.csv</code> is the information from the IUCN redlist used in Appendix S1 of the manuscript. sessionInfo() for the R workspace is below for transparency and hopefully reproducibility (we recognize that some code will require modification in the future, as some spatial packages used here are being replaced by others).<br>```{r}sessionInfo()```<pre><br>R version 4.4.2 (2024-10-31)<br>Platform: x86_64-pc-linux-gnu<br>Running under: Ubuntu 22.04.5 LTS<br><br>Matrix products: default<br>BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3 <br>LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3; LAPACK version 3.10.0<br><br>locale:<br> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C <br> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 <br> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 <br> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C <br> [9] LC_ADDRESS=C LC_TELEPHONE=C <br>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C <br><br>time zone: America/New_York<br>tzcode source: system (glibc)<br><br>attached base packages:<br>[1] stats graphics grDevices utils datasets methods base <br><br>other attached packages:<br> [1] RColorBrewer_1.1-3 ggplot2_3.5.1 ape_5.8 <br> [4] alphahull_2.5 rnaturalearthdata_0.1.0 countrycode_1.5.0 <br> [7] CoordinateCleaner_2.0-20 terra_1.7-39 raster_3.6-23 <br>[10] sp_2.1-4 geosphere_1.5-20 geometry_0.4.7 <br>[13] dbplyr_2.5.0 gbifdb_0.1.2 dplyr_1.1.4 <br>[16] plyr_1.8.9 <br><br>loaded via a namespace (and not attached):<br> [1] tidyselect_1.2.1 farver_2.1.2 arrow_12.0.1 <br> [4] R.utils_2.12.3 sgeostat_1.0-27 lazyeval_0.2.2 <br> [7] spatstat.geom_3.2-9 digest_0.6.37 lifecycle_1.0.4 <br>[10] sf_1.0-13 spatstat.data_3.0-4 magrittr_2.0.3 <br>[13] compiler_4.4.2 rlang_1.1.4 tools_4.4.2 <br>[16] utf8_1.2.4 data.table_1.16.2 labeling_0.4.3 <br>[19] bit_4.5.0 interp_1.1-4 classInt_0.4-9 <br>[22] xml2_1.3.6 abind_1.4-5 KernSmooth_2.23-24 <br>[25] withr_3.0.2 purrr_1.0.2 R.oo_1.26.0 <br>[28] grid_4.4.2 polyclip_1.10-6 fansi_1.0.6 <br>[31] e1071_1.7-16 colorspace_2.1-1 scales_1.3.0 <br>[34] spatstat.utils_3.0-4 cli_3.6.3 crayon_1.5.3 <br>[37] generics_0.1.3 rgbif_3.7.7 httr_1.4.7 <br>[40] magic_1.6-1 DBI_1.2.3 proxy_0.4-27 <br>[43] stringr_1.5.1 parallel_4.4.2 rnaturalearth_0.3.3 <br>[46] assertthat_0.2.1 vctrs_0.6.5 Matrix_1.7-1 <br>[49] jsonlite_1.8.9 bit64_4.5.2 hexbin_1.28.4 <br>[52] units_0.8-2 splancs_2.01-44 rgdal_1.6-7 <br>[55] glue_1.8.0 spatstat.random_3.2-3 codetools_0.2-19 <br>[58] stringi_1.8.4 gtable_0.3.6 deldir_1.0-9 <br>[61] munsell_0.5.1 tibble_3.2.1 pillar_1.9.0 <br>[64] R6_2.5.1 oai_0.4.0 lattice_0.22-5 <br>[67] R.methodsS3_1.8.2 class_7.3-22 Rcpp_1.0.13-1 <br>[70] nlme_3.1-165 whisker_0.4.1 rgeos_0.6-3 <br>[73] pkgconfig_2.0.3 </pre>