
📎 This article includes 2 downloadable practice files ↓
The script reads the data, calculates KPIs (orders, total, average order), summarises by product, writes a CSV and saves a chart. Run it again next month on new data and everything updates.
“`r
kpi <- sales |> summarise(orders = n(), total = sum(amount), avg = round(mean(amount)))
product <- sales |> group_by(product) |> summarise(qty = sum(qty), sales = sum(amount)) |> arrange(desc(sales))
write_csv(product, “product_summary.csv”)
“`
Reports with Quarto
RStudio’s File › New File › Quarto Document mixes text and R code chunks and renders to HTML, Word or PDF, so the whole report rebuilds with one click.
That’s the R course.
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 project script and check the CSV and PNG it creates.
📎 Practice files for this article
- 📈r-06-project.RLesson code file.⬇ R · 504 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.