02 - InvertR - Assignment II - Example in R
Overview
Alex Smith walks through an R workflow for analyzing ecological communities, using river macroinvertebrate data as a practice dataset before students apply the methods to deep-sea hydrothermal vent invertebrates. The workflow covers Equal Earth mapping, alpha diversity, Bray–Curtis dissimilarity and NMDS, environmental vectors, ANOSIM and PERMANOVA tests, and decomposition of beta diversity into turnover and nestedness; students then use their results to prepare a three-minute presentation.
Key takeaways
- The assignment's two-file data structure separates a site-by-taxon presence–absence matrix from site metadata such as latitude, longitude, water chemistry, and physical measurements.
- Species counts provide a straightforward alpha-diversity measure: compare sites or rivers with boxplots, use ANOVA for an overall test, and Tukey's test for pairwise differences.
- NMDS represents between-site community dissimilarity in a reduced space; a Shepard plot and stress value help assess how faithfully the ordination captures the original distances.
- Fitted environmental vectors help interpret NMDS patterns by showing which measured variables are associated with the ordination axes and site positions.
- ANOSIM and PERMANOVA provide tests of group-level community differences, while beta-diversity decomposition distinguishes spatial turnover from nestedness.
- The river macroinvertebrate example is intended to teach transferable analysis steps that students can reuse on hydrothermal vent communities and other ecological datasets.
Chapters
- The assignment applies ecological community analyses to deep-sea hydrothermal vent invertebrates, while the walkthrough uses separate aquatic macroinvertebrate data.
- The GitHub repository contains annotated code; download it with Code → Download ZIP, unzip it, and place it in the R working directory.
- The Equal Earth projection offers an alternative to familiar world maps that distort the relative area of regions.
- The practice dataset includes Welsh, Austrian, and North American river macroinvertebrates, including environmental DNA metabarcoding data.
- Smith frames the R code as a reusable toolkit that can be adapted to other habitats and organisms, including the hydrothermal vent assignment.
- For R errors, search for existing solutions first; if asking for help, include a screenshot showing the source, environment, console, and plot panes.
- The analysis loads two CSV files: a presence–absence matrix with sites as rows and taxa as columns, and metadata with coordinates and environmental measurements.
- The sf package supports spatial mapping; coordinate limits zoom the world map to the European rivers and nearby sampling region.
- The vegan package calculates site-level species counts as an alpha-diversity measure.
- Boxplots compare species richness across rivers; ANOVA tests for overall differences and Tukey's post-hoc test identifies differing river pairs.
- Bray–Curtis dissimilarities feed a non-metric multidimensional scaling (NMDS) analysis to visualize community composition across sites.
- A Shepard plot and the NMDS stress value assess how well the two-dimensional ordination represents the original dissimilarities.
- Environmental vectors fitted to the ordination indicate associations with axes, including conductivity and variables such as distance from the lake, pH, and temperature.
- ANOSIM and PERMANOVA test whether community composition differs among river groups using dissimilarities; both support differences in the example data.
- The beta-part analysis uses a Jaccard-based decomposition to report turnover, nestedness, and total beta diversity; the example shows a small nestedness component.
- Students should export a PDF of their plots, interpret their own hydrothermal vent data, and upload a YouTube link to a presentation of three minutes or less.
Transcript excerpt
0:01 Hello, good morning, good afternoon, good evening, good day, and welcome to however and whenever you're consuming this. Welcome to the second part of our exploration of deep sea hydrothermal vents and the invertebrates that live there and the vulnerability or the patchiness of those invertebrates uh using real data and using uh our code to create figures that are kind of publication ready uh but have not yet been published and that kind of telling that story is up to you. So, you [clears throat] have already uh been through the um background video. I'm guessing the background video that touches on and reminds you about the scenario that we're talking about these deep incredible deep sea hydrothermal
0:48 vents. Uh, so I'm going to work through the R code from this in installment of your assignments um today and I'm going to remind you that if R is still very frustrating to you um it's a process you work through and you learn by practicing and learn by being frustrated, this uh QR code leads you to some of the universities, the libraries uh in particular resources about using R. So what we're going to do uh today is work through the GitHub which is you've got a link to in your course link and it looks like this. Uh so just like the
1:39 other one uh you've got narration um little bits of blocks of description of of narrative of annotation. This is me speaking to you like explaining a little bit about what we're doing in the context of the code and in the context of the assignment. Uh, one of the other cool things in here that you'll see. So, and we'll talk again about how to download these, but you're basic just like last time, you go to code and you
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Alex Smith.