Quickstart Guide: Cross-Hemispheric Niche Transfer & Early Detection of Stinknet (Oncosiphon pilulifer)

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, visualization, and modeling packages:

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

3. Downloading the Project Folder & Launching the Apps

  1. 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 .zip archive).
    • Unzip (Extract All) the downloaded archive into a permanent folder on your computer (for example, Documents/Stinknet_Invasion_Suite/). Do not run the apps from inside a compressed .zip preview window.
    • Verify that the data/ and R/ subfolders sit directly inside your project directory alongside the three application scripts:
      • app1.R — Module 1: Cross-Continental Niche Transferability (South Africa → SW U.S., Australia & Mediterranean)
      • app2.R — Module 2: SW U.S. Invasion Curve, Equilibrium Violation & Vector Risk
      • app3.R — Module 3: Yuma County Early Detection & Rapid Response (EDRR) Survey Planner
  2. 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.

4. Data Architecture Overview

All spatial layers and occurrence records are standardized in native WGS84 geographic coordinates (EPSG:4326) so exported survey waypoints load directly onto mobile GPS apps (Google Earth, Avenza, Gaia GPS) and field maps:

  • Four Continental 5 km Windows (data/env_5km_ZA.tif, env_5km_SWUS.tif, env_5km_AU.tif, env_5km_MED.tif): Hemisphere-safe WorldClim 2.1 bioclimatic variables (BIO1–BIO19), elevation (ELEV), and Terrain Ruggedness (TRI) covering Southern Africa, SW North America, Southern Australia, and the Mediterranean Basin.
  • Global & Regional Occurrence / TGB Tables (data/stinknet_5km_global.csv, stinknet_swus_1km.csv, tgb_za_5km.csv, tgb_swus_1km.csv): Screened Oncosiphon pilulifer records paired with survey-controlled Asteraceae herbarium Target-Group Backgrounds (retaining each grid cell’s earliest detection year to reconstruct invasion timing).
  • SW U.S. Regional Invasion Stack (data/swus_invasion_1km.tif, swus_invasion_2km.tif, swus_primary_highways.gpkg): Combines 1 km climate and terrain with ESA WorldCover anthropogenic disturbance (Frac_Disturbed) and distance to U.S. Census TIGER primary highways (Dist_Highway_km).
  • Yuma County 250 m EDRR Stack (data/yuma_edrr_250m.tif, yuma_major_roads.gpkg, yuma_washes_rivers.gpkg, yuma_county_boundary.gpkg): Fine-scale distance to I-8/US-95 highways, local roads, washes and rivers (Gila River, Colorado River, Fortuna Wash), disturbed landcover, distance to known detections, and Jan–Apr botanical search effort (Spring_Survey_Effort).

Full GBIF archive DOIs, under-the-hood modeling parameters (domain definition, absence curation, and class balancing), and references are documented in the Data Sources & Curatorial Architecture section of the lab manual.