MENU

Fun & Interesting

Using stat_summary from ggplot2 to add a statistics layer to plots in R (CC089)

Riffomonas Project 13,798 4 years ago
Video Not Working? Fix It Now

Ever wonder what all of those stats functions do in ggplot2? In this episode of Code Club, Pat shows how you can use stat summary to add a summary layer to your data. No more creating summary data frames to plot on top of your raw data! Pat will use RStudio and functions from the #ggplot2 package including #stat_summary and other packages from the tidyverse. The accompanying blog post can be found at https://www.riffomonas.org/code_club/2021-04-07-stat_summary. 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 [email protected] or check out https://www.riffomonas.org/workshops/! R: https://r-project.org RStudio: https://rstudio.com Raw data: https://github.com/riffomonas/raw_data/releases/latest Workshops: https://www.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 Introduction 4:28 Removing old code 7:23 Inserting stat_summary code to create different types of figures 11:51 Demo of fun.data functions 13:42 Demo of different geom options 17:38 Critique of figure created with point / linerange 19:35 Conclusion

Comment