Using the vegan R package to generate ecological distances (CC188)
Channel: Riffomonas Project
Date: 2022-02-17

The vegan R package has a powerful set of functions for calcuating the ecological distance between communities. In this episode, Pat shares how to get your data in the right format to use vegdist and avgdist prior to analyzing the distances using NMDS. He discusses using rarefaction with avgdist to control for uneven sampling effort since the Bray-Curtis dissimilarity index is sensitive to uneven sampling effort. We'll use the metaMDS function from vegan and tools from ggplot2 and the tidyverse packages.

You can find my blog post for this episode at https://www.riffomonas.org/code_club/2022-02-17-distances. The data were generated in our Kozich et al. 2013 paper (http://doi.org/10.1128/AEM.01043-13) using samples from the Schloss et al. 2012 paper (http://doi.org/10.4161/gmic.21008).

#vegdist #avgdist #vegan #ggplot2 #R #Rstudio #Rstats

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.

If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/

0:00 Calculating ecological distances with the vegan R package
2:08 Preparing matrix of sample by taxa counts
10:23 Calculating distances using vegdist
12:27 Using community matrix directly in metaMDS
13:18 Rarefying distance calculations using avgdist