Adding lines and asterisks of statistical significance on a figure with ggplot2 (CC093)
Channel: Riffomonas Project
Date: 2021-04-16

Have you ever wondered how to add lines with asterisks to denote statistical significance on a plot you've made with ggplot2? In this episode of Code Club, Pat will walk you through performing a series of statistical tests with kruskal.test and pairwise.wilcox.test and how to use geom_line and geom_text to draw the lines and stars.


Pat will use RStudio and base functions including #kruskal.test and #pairwise.wilcox.text and the #geom_line and #geom_text functions from the #ggplot2 package and other packages from the tidyverse. The accompanying blog post can be found at https://riffomonas.org/code_club/2021-04-16-testing-significance

Do you have a figure that you would like to receive a critique or help improving? Let me know and I'd be happy to arrange a guest appearance!

If you're interested in taking an upcoming 3 day R workshop, email me at riffomonas@gmail.com!

R: https://r-project.org
RStudio: https://rstudio.com
Raw data: https://github.com/riffomonas/raw_data/releases/latest
Workshops: https://www.mothur.org/wiki/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 Introduction
3:23 Running kruskal.test and pairwise.wilcox.test
10:02 ggplot2 figures can be saved as objects
11:13 Drawing line segments to denote comparisons
13:57 Adding text to line segments
16:09 Critique of figure
19:21 Conclusion