
π This article includes 2 downloadable practice files β
In this article
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.
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
β¬ Download all 2 files (ZIP Β· 785 B)
- π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.