dplyr is a widely adopted r package, part of tidyverse, which uses English verbs to reshape data.

I made a small subset of the starwars dataset: small_sw

Arrange

Arrange to sort rows (observations) by column headers (variables)

Select

Select to choose columns (variables)

Filter

Filter to select rows (observations)

Mutate

Mutate to create new variables (columns)

Count

Count to summarize observations (rows)

Summarize

Summarize to collapse values into a summary

Put it all together

We can pipe commands together. Think of a pipe (i.e. %>%) as a conjunction. Any time you see a pipe, think “and then.” You can insert a pipe with ‘Ctrl+Shift+M’ (Help > Keyboard Shortcuts)

 
R We Having Fun Yet‽ -- Learning Series
Data & Visualization Services
Duke University Libraries
C bn
Shareable via Creative Commons: CC By-NC