typestar

Reshaping & reading

12 steps in 5 sets of R.

Getting data into the shape the rest of the tidyverse expects. Pivoting both directions, splitting columns apart, nesting a data frame inside a column, and filling gaps.

The last set is readr with explicit column types, which is the difference between a clean import and an afternoon of debugging why a column arrived as character.

Start this tour

Pivoting

Splitting columns

Nesting & gaps

  • NestingA list column of data frames, one per group — the tidy way to model per group.
  • Missing valuesdrop_na, replace_na and fill: three answers to a gap.
  • Filling in the gapscomplete and expand_grid create the rows that should exist but do not.

Reading & selecting

  • readrread_csv is faster than read.csv, and it tells you what it guessed.
  • readrFast, predictable delimited-file reading.
  • Tidy selectionThe selection language shared by select, across, pivot_longer and the rest.

Encore

  • tidy_report.RA whole tidyverse pipeline: read, clean, reshape, model per group, plot.

The other R tours