R Lesson 6: Project — A Sales Analysis Report

📎 This article includes 2 downloadable practice files ↓

⏱ 1 min read

📘 R Beginner Course · Lesson 6 of 6

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.

💡 Keep raw data, scripts and outputs in separate folders (data/, R/, output/) inside the project. Future you will thank you.

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

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.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong