urlfile<-'https://raw.github.com/utjimmyx/resources/master/avocado_HAA.csv'
data <- read.csv("avocado.csv")
summary(data)
##      date           average_price    total_volume         type          
##  Length:12628       Min.   :0.500   Min.   :    253   Length:12628      
##  Class :character   1st Qu.:1.100   1st Qu.:  15733   Class :character  
##  Mode  :character   Median :1.320   Median :  94806   Mode  :character  
##                     Mean   :1.359   Mean   : 325259                     
##                     3rd Qu.:1.570   3rd Qu.: 430222                     
##                     Max.   :2.780   Max.   :5660216                     
##       year       geography            Mileage    
##  Min.   :2017   Length:12628       Min.   : 111  
##  1st Qu.:2018   Class :character   1st Qu.:1097  
##  Median :2019   Mode  :character   Median :2193  
##  Mean   :2019                      Mean   :1911  
##  3rd Qu.:2020                      3rd Qu.:2632  
##  Max.   :2020                      Max.   :2998
hist(data$average_price ,
     main = "Histogram of average_price",
     xlab = "Price in USD (US Dollar)")

library(ggplot2)
ggplot(data, aes(x = average_price, fill = type))+
  geom_histogram(bins = 30, col = "magenta") +
  scale_fill_manual(values = c("yellow","orange")) +
  ggtitle("Frequency of Average Price - Organic vs. Conventional")

# Simple EFA with ggplot
ggplot() + 
  geom_col(data, mapping = aes(x = reorder(geography,total_volume), 
                               y = total_volume, fill = year )) +
  xlab("geography")+
  ylab("total_volume")+
  theme(axis.text.x = element_text(angle = 90, size = 7)) 

  1. Refer to your report and answer this question. How do the prices of organic and conventional avocados compare? Any other findings?
  1. Which city has the largest sales of organic and conventional Hass avocados in the dollar amount, respectively, for year 2017 and year 2018, respectively? What could be the possible reasons for Hass avocado’s popularity in these cities?
  1. Based on your analysis and list at least three reasons different stakeholders could benefit from your own marketing research. Retailers – Understanding price differences and consumer preferences helps businesses optimize inventory and pricing strategies. Since conventional avocados sell in larger quantities while organic ones are priced higher, retailers can adjust promotions and shelf space accordingly.

Farmers & Suppliers – Insights from this analysis can guide farmers in deciding whether to invest more in organic or conventional avocado production. By recognizing demand trends and pricing variations, they can make informed decisions about distribution and market positioning.

Marketers & Advertisers – Marketing teams can create more targeted campaigns based on regional preferences. Since Los Angeles has consistently high avocado sales, businesses can focus on local advertising, partnerships with restaurants, and promotions that align with consumer interests in health and food trends.