Welcome to Spatial Ecological Analysis in R for Nervous Humans

If you’ve ever asked something like:

  • Why do howler monkeys only occur in certain parts of the forest?
  • Where do seabirds cluster during breeding season?
  • How does tree cover change as you move up a mountain?

…then you’re already thinking spatially. Congratulations — you’re a spatial ecologist. You just didn’t have the R skills to go with it. Yet.

Ecology is full of questions about where things are and why they’re there. Spatial data is simply the way we record and interrogate those patterns.

So, what is spatial data?

At its simplest, spatial data is information tied to a location. That location might be a precise GPS point, a grid cell on a map, or a defined area like a forest patch or national park boundary.

A spatial dataset usually has two parts:

  1. Where something is (its coordinates or position in space)
  2. What is there (a measurement, observation, or category)

This could be a GPS fix where you recorded a howler monkey troop, a land-cover map across a region, or a grid of values showing temperature or elevation. In short, spatial data tells you not just what is happening, but where — and that “where” often turns out to be the most interesting part.

Why does “where” matter?

Because in ecology, location is rarely random. One of the oldest and most robust principles in spatial science is Tobler’s first law of geography: “Everything is related to everything else, but near things are more related than distant things” (Tobler 1970). Nearby places tend to be more similar environmentally, more connected by dispersal, and more ecologically interchangeable than distant ones.

This has real consequences. A forest patch next to a river might support a completely different community from one on dry hillside a kilometre away. Howler monkeys recorded clustering along a valley floor might be tracking food resources, avoiding predators, or simply reflecting where field teams walked. Distinguishing between those explanations requires spatial thinking.

If you ignore space, you miss these patterns entirely. Worse, you can reach the wrong conclusions. Models that ignore spatial structure can produce wildly overconfident results (Dormann et al. 2007), and conservation decisions based on spatially biased data have led to protected areas that miss the species they were meant to protect (Veloz 2009). Space is not a nuisance to be discarded; it’s information.

Types of spatial data

Broadly, spatial data in ecology comes in two forms:

Vector data. These are discrete objects in space. This includes points (a GPS fix for a monkey sighting), lines (a river or transect route), and polygons (a country boundary, a forest patch, a protected area). Vector data is precise and efficient for representing distinct features.

Raster data. These are continuous surfaces across space. A raster is a grid of cells, each holding a value: temperature, elevation, vegetation density, rainfall. Think of it as a digital photograph of the landscape where each pixel encodes an environmental measurement. Rasters are the workhorse of landscape-scale environmental analysis.

We’ll encounter both throughout this course.

What do we actually do with spatial data?

Once you have spatial data, the goal is usually some version of: what do we find, where, and why?

That might involve mapping observations to see patterns, comparing habitats or regions, testing whether a distribution is more clustered than expected by chance, or linking species presence to environmental variables to build a predictive model. By the end of this course, you’ll be doing all of these things.

Spatial data can look intimidating at first — coordinate systems, projections, raster stacks, and geometry columns are a lot to take in. But at its core, it is just a structured way of answering ecological questions you already understand.

Our species: the mantled howler monkey

Throughout this course we’ll use the mantled howler monkey (Alouatta palliata) as our focal species. Howler monkeys are so-called because of their deep, resonant roars, produced by a specialised hyoid bone that acts as a resonating chamber, that can carry up to 5 km through dense forest. Despite sounding like something out of Jurassic Park, they’re herbivorous, leaf-eating primates that live in groups of up to 20 individuals across Central American tropical forests.

They are also ecologically important. As folivores and frugivores, they are significant seed dispersers, and their population status is a useful indicator of forest health (Estrada et al. 2017). They have a solid GBIF record base, a well-defined range, and occupy a landscape with interesting environmental gradients, which makes them an ideal subject for learning spatial analysis. Any patterns we find will be real, ecologically meaningful, and interpretable.

References

Dormann, C.F., McPherson, J.M., Araújo, M.B., Bivand, R., Bolliger, J., Carl, G., Davies, R.G., Hirzel, A., Jetz, W., Kissling, W.D., Kühn, I., Ohlemüller, R., Peres-Neto, P.R., Reineking, B., Schröder, B., Schurr, F.M. & Wilson, R. (2007). Methods to account for spatial autocorrelation in the analysis of species distributional data: a review. Ecography, 30, 609–628.

Estrada, A., Garber, P.A., Rylands, A.B., Roos, C., Fernandez-Duque, E., Di Fiore, A., Nekaris, K.A.I., Nijman, V., Heymann, E.W., Lambert, J.E., Rovero, F., Barelli, C., Setchell, J.M., Gillespie, T.R., Mittermeier, R.A., Verde Arregoitia, L., de Guinea, M., Gouveia, S., Dobrovolski, R., Shanee, S., Shanee, N., Boyle, S.A., Fuentes, A., MacKinnon, K.C., Amato, K.R., Meyer, A.L.S., Wich, S., Sussman, R.W., Pan, R., Kone, I. & Li, B. (2017). Impending extinction crisis of the world’s primates: why primates matter. Science Advances, 3, e1600946.

Tobler, W.R. (1970). A computer movie simulating urban growth in the Detroit region. Economic Geography, 46, 234–240.

Veloz, S.D. (2009). Spatially autocorrelated sampling falsely inflates measures of accuracy for presence-only niche models. Journal of Biogeography, 36, 2290–2299.

Next →