Prof. Marc Los Huertos • Pomona College
Welcome to the RTricks resource hub for EA030. Tutorials, worked examples, and reference materials for R in environmental data analysis — from loading your first dataset through mixed-effects models and spatial analysis. Each card links to a self-contained module. Cards marked coming soon are in progress.
Setup, orientation, and reproducible workflow fundamentals.
Install R and RStudio, configure your environment, and verify with a test script.
coming soonOrganize scripts, data, and outputs using RStudio Projects and a consistent folder hierarchy.
coming soonWeave prose, code, and output into reproducible reports. YAML headers, chunk options, rendering.
coming soonReading CSV, Excel, and field-data files. Handling encoding issues and common pitfalls.
coming soon
Descriptive summaries, inference, and foundational visualization.
Measures of center and spread, frequency tables, base-R and dplyr summaries.
descriptiveCore ggplot2 grammar: geoms, aesthetics, facets, themes, and export-ready figures.
ggplot2Every statistical test you will encounter in environmental science fits into one of four frameworks determined by a single question: what type of variable is your outcome (dependent), and what type of variable is your predictor (independent)?
inferenceEvery classical statistical test — t-test, ANOVA, regression — is a formalization of the same underlying question: is the pattern I see in my data larger than what I would expect from chance variation alone?
inferencet-tests, Wilcoxon tests, proportions tests. Effect sizes, p-values, common misconceptions.
inferenceFitting, diagnosing, and interpreting OLS models with lm(). Residual plots and leverage.
regressionOne-way and two-way ANOVA, post-hoc tests, and visualizing group differences.
anova.
coming soonModeling binary outcomes — presence/absence, exceedance, survival — with logistic regression. Odds ratios, ROC curves, and model diagnostics.
logisticPearson and Spearman correlation, scatterplot matrices, and interpreting correlation structure.
coming soon
Multivariate methods, hierarchical models, and specialist tools for environmental data.
Multiple predictors, interactions, model selection (AIC), and GLMs for count and binary data.
coming soonTime-to-event analysis with Kaplan–Meier curves, log-rank tests, and Cox proportional hazards models. Applied to algae growth experiments and right-censored environmental data.
survivalRandom intercepts and slopes with lme4. Nested and crossed random effects for field designs.
coming soonImporting shapefiles, CRS transformations, spatial joins, and choropleth maps with sf.
coming soonPCA, NMDS, and RDA for community and environmental gradient data using vegan.
coming soonDecomposition, autocorrelation, ARIMA, and sensor-data workflows with lubridate and tsibble.
coming soonResampling-based inference, confidence intervals, and randomization tests.
coming soon
General-purpose, transferable R techniques applicable beyond EA030.
dplyr verbs, tidyr pivoting, and pipe-based workflows for cleaning field and lab data.
coming soonVersion-control basics, committing from RStudio, branching, and submitting via pull request.
coming soonLock package versions and share reproducible environments across machines.
coming soonpurrr::map() and friends to replace loops, write cleaner code, and automate repetitive tasks.
coming soonPublication-quality tables with kableExtra, gt, and flextable. Inline R in RMarkdown.
coming soon
Course-specific modules tied to EA030 assignments, field campaigns, and shared datasets.
Overview of all EA030 projects this semester — Regional Climate Trends, pHake Lake, Compost Maturity, Inland Empire Air Quality, and Surface Water Quality.
indexThirty years of daily fine particulate matter (PM2.5) for a US county. Download EPA AQS data, clean monitoring records, visualize long-term trends, compute monthly means with 95% CIs by decade, and evaluate exceedances of the 24-hr NAAQS (35 µg/m³). Includes environmental justice discussion. Helper functions in 06_EPA_PM25/.
air quality.
air qualityImporting and cleaning soil survey data, fitting depth profiles, and comparing land-use treatments.
coming soonTime-series of field sensor data, detecting exceedances, and visualising spatial variation.
coming soonSpecies richness, rarefaction curves, and community composition with vegan.
coming soonCamera traps record who was present, when, and what they were doing without a researcher present. This tutorial walks the complete analytical pipeline — from raw Excel export through cleaning, independent-event definition, descriptive ethograms, and four quantitative methods: chi-square/Fisher tests of diel behavior shifts, kernel-density activity overlap, rarefaction-corrected diversity, and single-season occupancy modeling.
projectDownloading NOAA/EPA data, trend detection, and visualising temperature and precipitation records.
coming soonAnalyzing long-term temperature and precipitation patterns across Southern California using PRISM and NOAA station data. Trend detection with Mann-Kendall tests and visualization of seasonal shifts.
climateRaster data from Landsat, land-cover classification, and surface temperature analysis.
coming soonJoining GPS tracks with field observations, plotting on basemaps, and exporting for reports.
coming soon
External references and community tools curated for EA030.
Hadley Wickham & Mine Cetinkaya-Rundel. The canonical tidyverse reference, freely online.
externalDense, searchable reference for base-R syntax — useful as a cheat-sheet during lab sessions.
externalFull function reference for every geom, stat, scale, and theme component in ggplot2.
externalOfficial one-page PDF cheatsheets for ggplot2, dplyr, tidyr, RMarkdown, and more.
external
Repository at github.com/marclos/RTricks. Each module
contains an index.Rmd, a data/ folder, and
rendered HTML. Clone or browse via the links.