
📎 This article includes 2 downloadable practice files ↓
“`r
library(readr); library(dplyr)
sales <- read_csv("sales.csv") |> mutate(amount = qty * rate)
sales |> filter(region == “North”) |> arrange(desc(amount)) |> head(5)
sales |> group_by(region) |> summarise(orders = n(), sales = sum(amount)) |> arrange(desc(sales))
“`
| dplyr | Excel |
|---|---|
| filter() | Filter / FILTER |
| mutate() | New formula column |
| arrange() | Sort |
| group_by() + summarise() | Pivot table / SUMIFS |
| left_join() | XLOOKUP / Merge |
|> is the pipe: “then”. Read the code top to bottom as a recipe.
Code for this course follows standard, current syntax; we test JavaScript and PowerShell scripts before publishing, and R/Java/Rust examples are kept to core language features. Tell us if anything fails on your setup.
Practice
Run the script and add a summary by product.
📎 Practice files for this article
- 📈r-04-dplyr.RLesson code file.⬇ R · 300 B
- 🧾sales.csv40 sample orders used by the scripts.⬇ CSV · 1 KB
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.
Stuck on a step? Ask a question and the AI answers using this article.