Parameterized Reports in R
📖 Scenario: You work in a small bookstore. You want to create a report that shows sales data for a specific month. Instead of making a new report every time, you will make a parameterized report that can show data for any month you choose.
🎯 Goal: Build a simple R script that uses a parameter (month) to filter sales data and then prints the total sales for that month.
📋 What You'll Learn
Create a data frame called
sales_data with columns month and sales and exact values.Create a variable called
selected_month to hold the month to filter.Use a filter to select rows from
sales_data where month matches selected_month.Calculate the total sales for the selected month and store it in
total_sales.Print the total sales with a clear message.
💡 Why This Matters
🌍 Real World
Stores and businesses often need reports filtered by dates or categories. Parameterized reports save time and avoid repeating work.
💼 Career
Data analysts and business intelligence professionals use parameterized reports to quickly generate insights for different time periods or segments.
Progress0 / 4 steps