Rdplyrggplot2Intermediate~4h

R for Data

Predict the R before you run it

R answers questions no other language is asked: what type did that vector become, what did the shorter operand do, did that subset hand back a table or a bare column, and why are the bars in alphabetical order. This is practice at answering all four from the page.

Modules
5
Drills
10
Build steps
3
Time
~4h

Walk out able to

Say what type, length and shape an R expression returns, and describe a plot as layers — which mapping, whose data, what the stat computed.

What you drill

01

Vectors that recycle

One type per vector, and the repeat R does not mention.

02

Frames, and what drops

One column left simplifies. One row left does not.

03

Five verbs, one row count

Filters, groups and joins, counted before they run.

04

The plot, and the factor

Layers, stats, and the levels behind every axis.

The pitch

What you practise, and what you leave with

A season report over a twelve-row counter table: busiest month per trail, a summary that keeps its quiet category, and a chart ordered on purpose.

You will practise

  • The type a mixed vector ends up holding
  • Recycling, and when R stays quiet about it
  • Rows out of a filter, a group and a join
  • Which layer supplies which mapping

Afterwards you can

  • Say what an R expression returns, before it runs
  • Tell a data frame from the column it dropped to
  • Count the rows a verb will return
  • Make a category order a decision, not the alphabet

Modules

5 modules, 29 items

Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.

  1. 1

    Everything is a vector

    ~51 min

    Get R running, then say what type an expression produces and what the shorter operand did.

    • LessonWhy R, and what to install4 min
    • LessonSay the type before you run the line6 min
    • LessonA bare 7 is not an integer7 min
    • DrillSay what the shorter vector did11 min
    • LessonPick values out three different ways6 min
    • LessonTwo edges that do not raise7 min
    • DrillAnswer when a value is missing10 min
  2. 2

    Rows, columns, and what drops

    ~45 min

    Read any value out of a table, say what it hands back, and write the line yourself.

    • LessonRead a value out of a table four ways7 min
    • LessonWhat a subset drops7 min
    • DrillSay what the subset hands back11 min
    • DrillWrite the line, do not read it10 min
    • Build stepType in the counter table10 min
  3. 3

    The five verbs

    ~1h

    Say what each verb changes about a table, and predict the row count coming out.

    • LessonSay what each verb promises6 min
    • LessonWhere the order changes the answer7 min
    • DrillCount the rows a filter keeps12 min
    • LessonCollapse a table to one row per group6 min
    • LessonThe category that vanished7 min
    • DrillCount the rows a join returns12 min
    • Build stepTotal each trail and rank them11 min
  4. 4

    The grammar of the plot

    ~45 min

    Read a plot as layers: which mapping, whose data, and what the stat computed.

    • LessonRead a plot as a sentence7 min
    • LessonWhat a layer inherits8 min
    • DrillSay what the stat computed11 min
    • DrillTell setting from mapping10 min
    • Build stepDraw the condition chart9 min
  5. 5

    Factors decide the order

    ~57 min

    Say what a factor is made of, and make a category order a decision rather than luck.

    • LessonExplain the order your bars came out in7 min
    • LessonSet the level order on purpose7 min
    • DrillTurn a factor back into numbers10 min
    • DrillCompare and combine two factors11 min
    • LessonShip the season report22 min

Say what it returns before you run it.

The first item is free. ~4h of focused work, at your own pace.

Intermediate~4h5 modules