This project was born out of curiosity about how avocado prices change across time, regions, and types. I wanted to explore a real-world dataset that combines both economic and agricultural perspectives. The Avocado Prices dataset from Kaggle provided the perfect playground: structured, rich, yet simple enough to analyze with the tools we learned in class.
The journey of this analysis unfolded in three main steps:
- Imported the CSV dataset into R.
- Explored its structure with
str(),summary(), andhead(). - Checked for missing values and unique counts per column.
- This step helped me understand the variables before diving deeper.
- Focused on AveragePrice, Total.Volume, and Total.Bags.
- Used boxplots to reveal unusual values.
- Outliers gave insight into extreme cases of pricing and sales volume that could impact analysis.
- Histogram of Average Price → to see how prices are distributed.
- Histogram of log(Total Volume) → log transform made skewed values easier to interpret.
- Scatter plot of Price vs Log(Volume) → revealed the relationship between sales volume and pricing.
- Built a Decision Tree regression model using log-transformed variables.
- Split the dataset into training (80%) and testing (20%).
- Visualized the tree and calculated Mean Squared Error (MSE).
- The model achieved a low error (~0.07), showing it captured the key patterns well.
- Outliers highlighted unusual pricing and sales activity.
- Visualizations clarified data distribution and trends.
- Decision Tree Model successfully predicted avocado prices using volume, year, and type.
- The analysis remained simple, interpretable, and faithful to classroom methods.
.
├── avocado.R # Main R script
├── avocado.csv # Dataset (ignored in .gitignore if excluded)
└── presentation/ # Presentation materials & plots
├── Asya_Berk_Avocado_Prices_Presentation.pdf
├── Avocado_Prices_Presentation.pdf
└── plots/
├── plot1.png ... plot7.png
- Clone the repository:
git clone https://github.com/Asyaberk/avocado-prices-r-project.git
- Download the dataset from Kaggle if not included.
- Place
avocado.csvin the project root. - Run the analysis in R:
source("avocado.R")
👩💻 Asya Berk
CMPE343 – Business Intelligence and Applied Analytics
Spring 2025
✨ This project was not just about coding — it was about telling a story with data. From exploring raw numbers to visual insights and predictive modeling, the journey showed how even something as simple as avocados can reveal fascinating economic patterns.