Nesting and unnesting in R
📖 Scenario: You work in a small company that keeps track of sales data. The data is grouped by salespeople, and each salesperson has a list of sales with amounts and dates.You want to practice how to group this data into nested lists and then flatten it back to a simple table.
🎯 Goal: You will create a nested data frame with sales grouped by salesperson, then unnest it back to a flat data frame showing all sales.
📋 What You'll Learn
Use a data frame with exact columns:
salesperson, amount, dateCreate a nested data frame grouped by
salespersonUnnest the nested data frame back to a flat data frame
Print the final unnested data frame
💡 Why This Matters
🌍 Real World
Nesting and unnesting data is useful when you want to group related information together and then expand it back for detailed analysis.
💼 Career
Data analysts and scientists often use nesting to organize complex data and unnesting to prepare data for reports or visualizations.
Progress0 / 4 steps