required_pkgs <- c(
"shiny", "dplyr", "tidyr", "DT",
"terra", "rpart", "rpart.plot", "randomForest"
)
new_pkgs <- required_pkgs[!(required_pkgs %in% installed.packages()[, "Package"])]
if (length(new_pkgs) > 0) {
install.packages(new_pkgs, dependencies = TRUE)
}
message("All required packages are installed and ready!")Quickstart Guide: Bursera microphylla & Vireo vicinior Ecological Niche & Dispersal Suite
Installation, Package Setup, Data Architecture, and Application Launch
1. Download and Install R and RStudio
Before launching the modeling modules, install R (the statistical computing engine) and RStudio Desktop (the integrated development environment):
- Install R (Version 4.3+):
- Visit the Comprehensive R Archive Network (CRAN) at https://cran.r-project.org/.
- Select your operating system (Download R for Windows, macOS, or Linux) and run the installer using default settings.
- Install RStudio Desktop:
- Visit Posit at https://posit.co/download/rstudio-desktop/.
- Download and install the free RStudio Desktop installer for your operating system.
2. One-Time Package Installation
Open RStudio, click into the Console pane, paste the following one-time setup script, and press Enter to install all required spatial, visualization, and modeling packages:
3. Downloading the Project Folder & Launching the Apps
- Download & Extract the Course Folder from Google Drive:
- Open the shared Google Drive link provided by your instructor and click Download (Google Drive will package the folder into a
.ziparchive). - Unzip (Extract All) the downloaded archive into a permanent folder on your computer (for example,
Documents/Bursera_SDM_Suite/). Do not run the apps from inside a compressed.zippreview window. - Verify that the
data/andR/subfolders sit directly inside your project directory alongsideapp1.R,app2.R, andapp3.R:app1.R— Module 1: Realized Niche, Herbarium Associates & CARTapp2.R— Module 2: Random Forest, Gray Vireo Dispersal & Lower Colorado Troughapp3.R— Module 3: Deep Time Refugia, 21st-Century Forecasts & Climate Velocity
- Open the shared Google Drive link provided by your instructor and click Download (Google Drive will package the folder into a
- Launch Any Module in RStudio:
- Open RStudio and go to File -> Open File… to open
app1.R(or Modules 2 or 3). - Set your working directory to the project folder via Session -> Set Working Directory -> To Source File Location.
- Click the green Run App button in the top-right corner of the script editor.
- Open RStudio and go to File -> Open File… to open
4. Data Sources & Processing Methods
Because this suite focuses on southwestern North America (-120° to -105°W, 22.5° to 36.0°N for flora; -122° to -104°W, 22.5° to 41.5°N for avian flyways), all spatial layers and occurrence tables are kept in native WGS84 geographic coordinates (EPSG:4326):
- Target Presences & Reciprocal Herbarium Reading (GBIF): Georeferenced occurrences for the Elephant Tree (Bursera microphylla) were gathered from the Global Biodiversity Information Facility (
DWCAarchive viargbif) and screened withCoordinateCleanerto exclude living/captive collections, fossils, zero coordinates, country centroids, institution coordinates, and ocean errors while preserving collectionyearandbasisOfRecordmetadata. Reading theassociatedTaxafield notes across co-occurring desert plant vouchers—searching for Bursera microphylla and its historical synonyms (Elaphrium microphyllum, Terebinthus microphylla)—surfaced 13 previously uncataloged Bursera presence records, which are preserved and mapped distinctly in Module 1. - Curated 13-Group Absence Pool (Target-Group Background & Conifer Outgroups): Following Phillips et al. (2009), absences are drawn without replacement from surveyed locations where botanists documented sympatric flora without recording B. microphylla. The pool weaves together two montane outgroups (Pinaceae and Cupressaceae, anchoring cooler/wetter abiotic boundaries across northern Mexico and southwestern uplands), congeneric Bursera spp. (capturing the tropical deciduous forest transition in Sonora and Baja California Sur), and the Top 10 plant genera most frequently recorded alongside B. microphylla on herbarium sheets.
- Multi-Scale Spatial Thinning & 1 km Environmental Extraction (WorldClim 2.1 & ESA WorldCover): All 19 modern bioclimatic variables (
BIO1–BIO19), elevation (ELEV), 30 arc-second Terrain Ruggedness Index (TRI), Topographic Position Index (TPI), and Hyper-Arid Barren Substrate (Frac_Barren_Playa) were read at 1 km (30 arc-sec) resolution for every occurrence point and tagged with1 km,5 km, and10 kmgrid identifiers so students can test scale sensitivity interactively. Any grid cell occupied by B. microphylla at the chosen grain is strictly excluded from the absence pool. For regional map projection and display, climate layers use the 5 km (2.5 arc-min) grid, withTRIaggregated by pixel maximum (preserving the signal of mountains) andFrac_Barren_Playaaggregated by pixel minimum (preserving the signal of rocky desert micro-refugia). - Avian Dispersal Partner (Vireo vicinior) & Structural Vegetation (USNVC / ESA WorldCover): Gray Vireo (Vireo vicinior) records spanning eBird, iNaturalist, and museum vouchers were gathered from GBIF, organized into four ecological seasons aligned with winter Bursera frugivory and spring/fall migration, and paired with USNVC-aligned physiognomic formations (
Woodland/Piñon-Juniper,Desert Bajada Scrub,Grassland,Hyper-Arid Barren). - Quaternary Paleoclimate Reconstructions (Beyer2020 via
pastclim) & Packrat Middens (Neotoma): Five-kilometer hindcast climate stacks span the Last Glacial Maximum (~21,000 BP) and Mid-Holocene (~6,000 BP) and are paired with radiocarbon-dated Bursera macrofossils gathered from the Neotoma Paleoecology Database (neotoma2) for independent paleo-validation. - 21st-Century Climate Forecasts (CMIP6 ACCESS-CM2) & Climate Velocity: Five-kilometer future climate stacks cover Mid-Century (2041–2060) and Late-Century (2061–2080) under moderate (SSP2-4.5) and high-emissions (SSP5-8.5) scenarios, supporting range-turnover modeling and spatial Climate Velocity calculations (\(\text{km yr}^{-1}\); Loarie et al. 2009).