---
layout: post
title: "Performing principle coordinate analysis (PCoA) in R and visualizing with ggplot2 (CC186)"
blurb: "PCoA with base R and ggplot2"
author: "PD Schloss"
date: 2022-02-10 11:00
comments: false
youtube: G5Qckqq5Erw
start_hash: e14ff12ef551aec7bfd74323551d2726cabccd8d
end_hash: f1d31bf29443ee4986e16ea045e35946a3e06bf5
---

Principle coordinate analysis (PCoA) and its relative, principle 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.


<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


## Code

You can browse the state of the repository at the
* [beginning of the episode](https://github.com/riffomonas/distances/tree/{{ page.start_hash }})
* [end of the episode](https://github.com/riffomonas/distances/tree/{{ page.end_hash }})
