Quickstart Guide: North American Pinus Ecological Niche & Climate Projection 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):

  1. 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.
  2. Install RStudio Desktop:

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, paleoclimate, and machine learning packages:

required_pkgs <- c(
  "shiny", "shinycssloaders", "dplyr", "tidyr", "DT",
  "terra", "geodata", "rpart", "rpart.plot", "randomForest",
  "pROC", "FNN", "rgbif", "neotoma2", "pastclim"
)

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!")

3. Downloading the Project Folder & Launching the Apps

  1. Download & Extract the Project Folder:
    • Download the course project .zip archive and extract (unzip) it to a permanent folder on your computer (e.g., Documents/pines/).
    • Verify that the data/ subfolder is located directly inside the project directory alongside pinus_app1.R, pinus_app2.R, pinus_app3.R, and pinus_app4.R.
  2. Launch Any Module in RStudio:
    • Open RStudio and go to File -> Open File… to open pinus_app1.R (or Modules 2, 3, or 4).
    • 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.

4. Data Sources & Processing Architecture

All spatial layers are standardized to the North American Albers Equal Area Conic projection with a central meridian at 100o West (NAD83, units in meters):

  • Taxonomic Hierarchy (The Gymnosperm Database): Subgeneric, sectional (P. sect. Pinus, P. sect. Trifoliae, P. sect. Quinquefoliae, P. sect. Parrya), and subsectional classifications follow Christopher J. Earle’s The Gymnosperm Database (https://www.conifers.org/pi/Pinus.php).
  • Occurrence Records & Biome Outgroups (GBIF): Georeferenced occurrences for native North American Pinus species and six widespread biome anchor species (Larrea tridentata, Artemisia tridentata, Betula nana, Bouteloua gracilis, Adenostoma fasciculatum, and Acer saccharum) were retrieved via rgbif::occ_download(). Records were thinned to unique 1 km grid cells and filtered using a 3rd-nearest-neighbor (\(\le 100\text{ km}\)) spatial outlier rule to remove cultivated plantings and geocoding errors.
  • Late 20th Century Climate Normal (1970–2000 CE) & Topographic Ruggedness (WorldClim 2.1): Seventeen shared bioclimatic variables (BIO1, BIO4–BIO19) and the Terrain Ruggedness Index (TRI) were extracted at 1 km resolution to train models across steep montane gradients. For continental map projections, Bioclim layers were aggregated to 5 km using the pixel mean, while TRI was aggregated to 5 km using the pixel maximum to preserve canyon and sky-island ruggedness.
  • Quaternary Paleoclimate Reconstructions (Beyer2020 via pastclim): Hindcast grids at 5 km resolution span the Last Glacial Maximum (~21,000 BP) and the three formal IUGS Holocene stages: Greenlandian (11,700–8,300 BP), Northgrippian (8,300–4,200 BP), and Meghalayan (4,200–0 BP).
  • 21st-Century Climate Forecasts (CMIP6 MRI-ESM2-0): Projected 5 km grids cover Early Century (2021–2040), Mid-Century (2041–2060), and Late-Century (2081–2100) under moderate (SSP2-4.5) and high-emissions (SSP5-8.5) scenarios.
  • Fossil Packrat Middens & Macrofossils (Neotoma Paleoecology Database): Retrieved via neotoma2 across the Late Pleistocene and Holocene (0–50,000 cal yr BP) for independent paleo-validation.
  • Wildfire Perimeters (USGS/USFS MTBS) & Bark Beetles (Dendroctonus & Ips): National Monitoring Trends in Burn Severity (MTBS) fire perimeters (1985–present) and GBIF bark beetle detections (1975–present) were aggregated into 5-year time slices on the 5 km Albers grid to evaluate disturbance exposure across shifting pine ranges.