Data science

Stage 1 of 10 · 7 lessons · ~5 weeks

R for data: the tidyverse

Set up RStudio and a project with renv, then learn the tidyverse work you will do every day: reading data, the dplyr verbs, grouping, joining and reshaping with tidyr.

Start: Notebooks and a clean environment

Lessons· one lesson for each topic, in this order

  1. 1Notebooks and a clean environment
  2. 2R vectors, types and NA
  3. 3Tibbles and the dplyr verbs
  4. 4Selecting columns and filtering rows
  5. 5Grouping and summarising
  6. 6Joining tables
  7. 7Reshaping between long and wide

Do this

  • Set up a notebook tool and a per-project environment, and put the project in Git.
  • Load a public dataset and check its shape, types and first rows.
  • Write filters for three different populations and state each one in plain words.
  • Produce a summary per group with a count column next to every average.
  • Join two tables and check the row count before and after.
  • Reshape one table from wide to long and back.

Start with

  • BookFree
    R for Data Science (2e)

    Wickham, Çetinkaya-Rundel, Grolemund · Beginner

    Free online: the Whole game and Transform chapters teach the tidyverse verbs in the order you need them

Practise

  • Pick one dataset on a topic you care about and repeat every operation in this stage on it

Keep handy

  • Set up projects, the console and Quarto documents properly before you start

Before moving on: A notebook that loads a real public dataset, checks its types, filters it to one clear population, joins a second table with a row-count check, reshapes it, and prints three summary tables, all rerunnable from a clean start.

Tauseef's advice
Learn the tidyverse first, not base R tricks from old forum answers: R for Data Science teaches exactly the verbs you need. Use RStudio projects and renv from day one, and write in Quarto so your analysis and its explanation live in one file.

Mark this stage as not done?