Performing principal coordinate analysis (PCoA) in R and visualizing with ggplot2 (CC186)
Channel: Riffomonas Project
Date: 2022-02-10

Principal coordinate analysis (PCoA) and its relative, principal component analysis (PCA) are popular ordination techniques that you can use to reduce the dimensions of data in R. In this episode, Pat Schloss will show how to perform PCoA in R and visualize the ordination and companion scree plot. We'll use the cmdscale function from base R and tools from ggplot2 and the tidyverse package.

You can find my blog post for this episode at https://www.riffomonas.org/code_club/2022-02-10-pcoa. 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).

#cmdscale #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 Performing principal coordinates analysis in R
3:45 Running cmdscale to generate ordination
4:14 Plotting ordination data with ggplot2
6:36 Getting data for more than 2 axis
7:18 Determining percent of variation explained by each axis
15:53 Creating a scree plot