Concept explainers

Small interactive widgets to build intuition for a few tricky ideas

These are little hands-on toys to poke at some concepts that are easier to feel than to read about. Nothing here is graded or required — click around and see what changes. Each one maps to something we cover in the sessions.

dplyr verbs: what does each one do to your data?

Data wrangling in the tidyverse is really just a handful of verbs, each doing one clear thing to a table. Click a verb below to watch what happens to a slice of our World Values Survey data — which rows drop, which columns appear or disappear, what gets added. mutate() has a few variants worth comparing (if_else() vs case_when()).

Relates to Session 2 — Data Wrangling with tidyverse.

A slice of our World Values Survey data (wvs_data). Click a dplyr verb to see what it does to the table.


      

<chr> vs <fct>: why does R care?

A “factor” is one of the most confusing types when you’re starting out. The key idea: a factor is not the same as “ordered” — it’s a column whose set of allowed levels is fixed and remembered. That changes how it sorts, how it plots, and what happens when a category has zero rows. Switch between an ordered (Likert) and a nominal (country) variable, and try each behaviour to see the difference side by side.

Relates to Session 2 & 3 — data types, wrangling, and visualization.

Same survey column, stored two ways. Compare how a plain character behaves versus a factor.

variable
behaviour


  

as character <chr>

as factor <fct>

Which chart should I use?

The trick to picking a ggplot chart is not memorising chart names — it’s answering two questions: how many variables am I showing, and what type is each one (categorical or continuous)? The geom follows from there. Set the count and types below and you’ll get the recommended chart(s), a schematic preview, and starter code using our wvs_cleaned data.

Relates to Session 3 — Data Visualization.

The strategy: count your variables, decide each one's type, then let the chart follow. Examples use our wvs_cleaned data.

1. how many variables?
2. what type is each?