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: Natural History Records and the Case of the Missing Absence
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 alongside the three application scripts: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 Architecture Overview
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 standardized in native WGS84 geographic coordinates (EPSG:4326):
- 1 km Environmental Extraction + Multi-Scale Thinning (
data/target_presences_wgs84.csv,data/background_pool_wgs84.csv): Every presence and inferred absence record carries environmental values read at 1 km (30 arc-sec) resolution alongside1 km,5 km, and10 kmgrid IDs so you can test spatial scale interactively. - 5 km Regional Rasters (
data/env_5km_wgs84.tif,data/usnvc_5km_wgs84.tif): Modern WorldClim 2.1 climate layers (BIO1–BIO19), terrain (ELEV, maximumTRI, meanTPI), and ESA WorldCover / USNVC vegetation layers (withFrac_Barren_Playaaggregated by pixel minimum to preserve rocky micro-refugia). - Deep Time & Future Projections (
data/bioclim_paleo_5km_wgs84.tif,data/bioclim_future_5km_wgs84.tif): Last Glacial Maximum (21 ka) and Mid-Holocene (6 ka) reconstructions (Beyer2020) paired with CMIP6ACCESS-CM2mid- and late-century projections (SSP2-4.5&SSP5-8.5). - Independent Ecological & Fossil Overlays (
data/gray_vireo_occurrences.csv,data/neotoma_bursera_fossils.csv,data/associated_taxa_frequencies.csv): Seasonally classified Vireo vicinior detections, radiocarbon-dated Neotoma packrat midden macrofossils, and the full herbarium associates frequency table.
Full GBIF archive DOIs, processing protocols, and citations are documented in the Data Sources & Curatorial Methods section of the lab manual.