Skip to main content

Data Science with R

Eight data-wrangling parts, then EDA: testing, regression, PCA

Author
Affiliations

A. Stamm

A hands-on class on doing data science in R: eight data-wrangling parts (Introduction → Manipulate Data Types) and an exploratory data analysis extension covering hypothesis testing, linear modeling and principal component analysis. The data-wrangling slides are Keynote decks exported to PDF; the EDA slides are interactive Quarto revealjs decks. Every part pairs its slides with a Quarto exercise file you can open and work through.

This material builds on the work of Garrett Grolemund from posit, reusing part of his tidyverse-related workshop material from https://github.com/rstudio-education/remaster-the-tidyverse under the Creative Commons BY-SA 4.0 license.

Data wrangling with R

Slides (PDF) and exercises (Quarto) for each of the eight parts. Open an exercise file to work through it; download any supplementary material listed.

Part Title Slides Exercises Suppl. Material
1 Introduction PDF Quarto
2 Visualize Data PDF Quarto
3 Transform Data PDF Quarto CSV
4 Model Data PDF Quarto ZIP
5 Communicate Data PDF Quarto Quarto
6 Tidy Data PDF Quarto
7 Join Data PDF Quarto
8 Manipulate Data Types PDF Quarto

Exploratory data analysis with R

Three parts, each with an interactive slide deck and a matching exercise file.

Part Title Slides Exercises Suppl. Material
1 Hypothesis Testing Quarto Quarto
2 Linear Regression Quarto Quarto ZIP
3 Principal Component Analysis Quarto Quarto ZIP

Prerequisites

R packages

  • Data sets: {babynames} (baby-name frequency, US 1880–2017), {nycflights13} (2013 NYC flight records).
  • Data wrangling: {janitor}, {skimr}.
  • Extra visualization: {ggcorrplot}, {ggfortify}, {plotly}.
  • Reporting: {DT} (DataTables), {gt}, {kableExtra}.
  • Model summaries: {broom}.
  • PCA: {FactoMineR}, {factoextra}, {corrplot}, {viridis}, {huxtable}, {umap}.