Mar 22, 2021
|
54 min
|
24.5k views
Statistics in R for Beginners: Import Data, Explore with the Tidyverse and Run an ANOVA
How to run statistics in R, start to finish: import a dataset, explore it with the tidyverse, plot it with ggplot2, convert your grouping variables to factors, then fit an ANOVA with the formula interface, read the output as a tidy data frame, and follow it with post hoc pairwise comparisons. The same formula interface runs a t test or a linear regression, so what you learn here transfers. With Tom Mock.
What you will learn
Why reproducible code beats point-and-click, and what that means day to day How R and RStudio relate to each other Your first lines of R in the console, and your first ggplot What the tidyverse verbs do, and why the code reads like a sentence How to import a dataset with the RStudio import wizard How to summarise by group, and how to facet a plot by a grouping variable Why you convert variables to factors before you model, and what happens if you do not How to fit an ANOVA, read its output, and run post hoc pairwise comparisons How to add error bars and significance markers to the final plot Chapters 0:00 What this session covers 2:29 Why R, and what reproducibility buys you 5:48 The R learning curve, and getting past the first hump 7:28 What R users say they value most 10:16 R and RStudio: the engine and the dashboard 12:27 Working in the console: your first lines of R 14:57 Your first ggplot 17:26 The tidyverse verbs, and why they read like sentences 19:56 The dataset: a study of cognitive function 22:25 Importing data with the RStudio import wizard 24:55 Summarising with group_by and summarise 27:24 Faceting a plot by health status 29:54 Turning variables into factors before you model 32:24 Saving a summary table and plotting it 34:53 Running an ANOVA: the formula interface 37:23 Reading the ANOVA output as a tidy data frame 39:52 Post hoc tests and pairwise comparisons 42:22 Adding error bars and significance markers 44:51 What to do next 47:21 TidyTuesday, the forum, and where to ask questions 49:50 Closing thoughts on learning R 52:20 Package documentation and cheat sheets
Learn more tidyverse: https://www.tidyverse.org RStudio IDE: https://posit.co/products/open-source/rstudio/ R for Data Science: https://r4ds.hadley.nz Posit cheat sheets: https://posit.co/resources/cheatsheets/
Recorded in 2019. The tidyverse functions shown are current; RStudio Cloud is now Posit Cloud
cheatsheets
ggplot2
rstudio
tidyverse
tidyverse.org
How to Do Anova in R
Anova in R
R for Statistical Analysis
Statistical Programming With R
T Test in R
Statistics in R
Tidy Statistics
Import Data in R
Ggplot2 Tutorial
Post Hoc Test R
R for Beginners
Tidyverse
Posit