install.packages(“ggplot2”) install.packages(“dplyr”) install.packages(“readr”) install.packages(“scales”)

library(ggplot2) library(dplyr) library(readr) library(scales)

my_data <- read_csv(“avocado.csv”)

head(my_data) str(my_data) summary(my_data) colSums(is.na(my_data))

my_data\(date <- as.Date(my_data\)date)

ggplot(my_data, aes(x = date, y = average_price)) + geom_line(color = “steelblue”) + labs(title = “Average Price Over Time”, x = “Date”, y = “Average Price”) + theme_minimal()

ggplot(my_data, aes(x = type, y = total_volume, fill = type)) + geom_bar(stat = “summary”, fun = “sum”) + labs(title = “Total Volume Sold by Product Type”, x = “Product Type”, y = “Total Volume”) + theme_minimal()

Insights

The first plot shows the average price over time. The second plot shows that conventional avocados sell more than organic.