Regork Growth Oppurtunities

Introduction

Growth Possibility:

  • The business problem we are trying to solve is what are the top healthy and unhealthy food products consumers purchase and if those products have a correlation to demographics to better market specific products to specific consumers.

How we got to our solution:

  • We got to our solution by first breaking down and defining the top healthy foods versus the top unhealthy foods. Once we completed this assessment we were able to use these key findings in analysis with different demographics, such as age, income, and household size to better understand consumer purchase habits. After this analysis, we were able to broaden our search to evaluate the impact that coupons have on consumer purchases as well as the difference in purchasing products, specifically candy at the checkout line compared to packaged throughout the store. In the end, all of these findings allowed us to come up with recommendations for Regork to better market specific products to specific consumers.

Why is This Report and Analysis Useful:

  • This report and analysis are useful as they provide evidence of the characteristics that lead consumers to purchase different healthy and unhealthy foods. In addition, we are able to take the top 5 unhealthy and top 5 healthy products sold and compare these products against each other to in the end provide recommendations to better market specific products to specific consumers.

Package Required

Below are the perquisite libraries that need to be imported to conduct my exploratory data analysis:

  • tidyverse - Tidy the data
  • dplyr - Manipulate the data
  • ggrepel - Label the data
  • lubridate - Conduct data manipulation
  • completejourney - Where the data is coming from
  • DT - Used to display the data on the screen in a scroll able format
  • rmarkdown - Used to utilize table funtions in rmarkdown
library(tidyverse)
library(dplyr)
library(ggrepel)
library(lubridate)
library(completejourney)
library(DT)
library(rmarkdown)

Data Preparation

Data Import

library(completejourney) 

transactions <- get_transactions()

Data Manipulation

In order to conduct this analysis, we must join together the following data sets:

  • Demographics

  • Transactions

  • Products

Along with that, dropping variables that won’t be of use initially will make the data a bit more clean.

df <- campaigns %>%
  inner_join(demographics, by = 'household_id') %>%
  inner_join(transactions, by = 'household_id') %>%
  inner_join(products, by = 'product_id') %>%
  inner_join(campaign_descriptions, by = 'campaign_id') %>%
  filter(
    as.Date(transaction_timestamp, format = "%Y-%m-%d") > start_date,
    as.Date(transaction_timestamp, format = "%Y-%m-%d") < end_date
    )

class(df)
## [1] "spec_tbl_df" "tbl_df"      "tbl"         "data.frame"
colnames(df)
##  [1] "campaign_id"           "household_id"          "age"                  
##  [4] "income"                "home_ownership"        "marital_status"       
##  [7] "household_size"        "household_comp"        "kids_count"           
## [10] "store_id"              "basket_id"             "product_id"           
## [13] "quantity"              "sales_value"           "retail_disc"          
## [16] "coupon_disc"           "coupon_match_disc"     "week"                 
## [19] "transaction_timestamp" "manufacturer_id"       "department"           
## [22] "brand"                 "product_category"      "product_type"         
## [25] "package_size"          "campaign_type"         "start_date"           
## [28] "end_date"
df <- df %>%
  select(-c(manufacturer_id, package_size, retail_disc))

Data Preview

datatable(head(df,50))

Meta Data

class_meta <- sapply(df, class)
null_meta <- sapply(df, function(df) sum(is.na(df)))
var_name <- colnames(df)

df_meta <- cbind(var_name, class_meta, null_meta)
rownames(df_meta) <- NULL
colnames(df_meta) <- c('Variable Name', 'Class', 'NULL Vals')
datatable(df_meta)

Exploratory Data Analysis

Our end goal is to categorize products into healthy and unhealthy food and find the top selling products within those categories in different income group and see if there is any correlation with coupons sold so we can give insight into what coupons to start or stop promoting

First Step in the analysis is to look at the data and identify the sales of each product category

paged_table(aggregated_data)

Based on this table, we were able to sort the table to showing the highest selling product categories and from there identified the highest selling healthy and unhealthy products.

Top 5 Healthy

  1. Products Beef- 176614.54

  2. Fluid milk products- 116360.68

  3. Cheese- 107011.61

  4. Chicken- 52703.51 P

  5. ork- 50809.31

Top 5 Unhealthy Products

  1. Soft Drinks- 182126.30

  2. Bag snacks- 84943.85

  3. Beers/ales- 82429.70

  4. Ice cream/milk/sherberts- 46876.51

  5. Candy packaged- 43680.94

data<-data.frame(product_category=c("SOFT DRINKS","BAG SNACKS", "BEERS/ALES","ICE CREAM/MILK/SHERBTS","CANDY - PACKAGED", "BEEF","FLUID MILK PRODUCTS","CHEESE","CHICKEN","PORK"),total_sales=c(182126.30,84942.85,82429.70,46876.51,43680.94,176614.54,116360.68,107011.61,52703.51,50809.31))
 ggplot(data,aes(x=product_category,y=total_sales,fill=product_category))+geom_bar(stat="identity")+labs(title="Top 5 unhealthy and healthy products based on sales")+theme_minimal()+theme(axis.text.x = element_text(angle = 45, hjust = 1))

By defining the top 5 healthy and unhealthy products sold. This allowed us to get a better understanding of what products consumers are purchasing to be able to compare the data to demographics. As shown, the unhealthy product of soft drinks has the highest sales value and is comparable to the top healthy product sold beef.

The next part of our analysis is to analyze the top selling products and top selling healthy product by the income demographic in hopes of gaining some insight into any trends of which healthy or unhealthy products are commonly sold to certain income groups sow we can better target are audiences with healthier coupons.

Low Income

low_income <- transactions %>%
  inner_join(demographics) %>%
  inner_join(products) %>%
  select(income, product_category, product_id) %>% 
  filter(income == c("Under 15K", "15-24K")) %>%
  count(product_category) %>%
  slice_max(order_by = n, n = 25) %>% 
  ggplot(aes(n, fct_reorder(product_category, n))) +
  geom_point(colour = "blue") +
  labs(title = "Top 25 Products of Low Income Households",
       subtitle = "") + 
  scale_x_continuous(name = "Total Number of Units Sold", labels = scales::comma) +
  scale_y_discrete(name = "Product Category")  +
  theme(axis.title.x = element_text(colour = "#0c4b99"),
        axis.title.y = element_text(colour = "#0c4b99"))
## Joining with `by = join_by(household_id)`
## Joining with `by = join_by(product_id)`
low_income 

target_categories <- c("BEEF","CHEESE","CHICKEN","PORK","BAKED BREAD/BUNS/ROLLS","FRUIT","EGGS","SALAD","MELONS","BERRIES","GRAPES","YOGURT","CARROTS","APPLES","HERBS","SQUASH","CORN","CITRUS","BROCCOLI/CAULIFLOWER")
filteredloww_df <- df %>%
  filter(
    product_category %in% target_categories,
    income == "35-49K"  
  ) %>%
  group_by(product_category) %>%
  summarise(sales = sum(sales_value, na.rm = TRUE)) %>%
  ungroup()
ggplot(filteredloww_df, aes(x = product_category, y = sales, fill = product_category)) +
  geom_bar(stat = "identity", show.legend = FALSE) +
  labs(
    title = "Sales of Healthy Product Categories for Low Income",
    x = "Product Category",
    y = "Sales"
  ) +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_y_continuous(labels = scales::dollar_format())

Based off our graphs, we can find insights into what healthy products are doing better in different income ranges. Below are some insights across the board:

  • Soft Drinks are highly bought and sought after items, decrease the coupons made to promote healthier products and increase revenue for soft drinks.

  • There is a signigant difference in the amount of fresh fruit consumed in low income households compared to medium and high income household. Increase the amount of coupons for fruit so low income households can have better opportunities to eat healthier

  • Yogurt is bought over 50 percent less in low income households than high income households

  • Candy is consistantly in the top 25 bought items across all incomes

merged_data <- merge(transactions,products,by= "product_id")
coupon_merged <- merge(merged_data,coupon_redemptions,by="household_id")
top_coupons <- coupon_merged %>%
  group_by(coupon_upc)%>%
  group_by(product_category)%>%
  summarise(count=n())%>%
  arrange(-count)
top_coupons %>%
  head(10)%>% 
  ggplot(aes(x = reorder(product_category, -count), y = count)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(title = "Top 10 Coupon Uses", x = "Product Coupon", y = "Usage Count") +theme_minimal()

When analyzing the top healthy and unhealthy products based on sales it is crucial to understand the impact that coupons have on purchasing patterns. In our graph, it is evident that the top products that can be linked to coupons are bag snacks, fluid milk products, cheese, and soft drinks. Overall, this accounts for 2 of the top 5 healthy products and 2 of the top 5 unhealthy products, which can lead to understanding why those 4 products were listed as being top purchased products.

candy<-data.frame(product_category=c("CANDY - PACKAGED","CANDY - CHECKLINE"), total_sales=c(43680.94,16094.76))
 ggplot(candy,aes(x=product_category, y=total_sales))+geom_bar(stat="identity")+ labs(title="Packaged Candy vs Checkline Candy Sales", x="Candy", y="sales") +theme_minimal()

In our last analysis, we evaluated candy in the checkout line and candy that is packaged in the rest of the store. We prepared this analysis with the purpose of understanding the difference in packaged versus checkout-line candy as packaged candy is in the top 5 unhealthy products sold and check-line candy is not in the top 5. With further investigation, we found that check line candy accounts for less than 50% of the overall candy sold by the store.

Medium Income

mid_income <- transactions %>% 
  inner_join(demographics) %>% 
  inner_join(products) %>%
  select(income, product_category, product_id) %>% 
  filter( income == c("25-34K", "35-49K", "50-74K", "75-99K")) %>% 
  count(product_category) %>% 
  slice_max(order_by = n, n = 25) %>%
  ggplot(aes(n, fct_reorder(product_category, n))) +
  geom_point(colour = "blue") +
  labs(title = "Top 25 Products of Mid Income Households",
       subtitle = "") + 
  scale_x_continuous(name = "Total Number of Units Sold", labels = scales::comma) +
  scale_y_discrete(name = "Product Category") +
  theme(axis.title.x = element_text(colour = "#0c4b99"),
        axis.title.y = element_text(colour = "#0c4b99"))
## Joining with `by = join_by(household_id)`
## Joining with `by = join_by(product_id)`
## Warning: There were 2 warnings in `filter()`.
## The first warning was:
## ℹ In argument: `income == c("25-34K", "35-49K", "50-74K", "75-99K")`.
## Caused by warning in `==.default`:
## ! longer object length is not a multiple of shorter object length
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.

filteredmedium_df <- df %>%
  filter(
    product_category %in% target_categories,
    income == "75-99K"  
  ) %>%
  group_by(product_category) %>%
  summarise(sales = sum(sales_value, na.rm = TRUE)) %>%
  ungroup()
ggplot(filteredmedium_df, aes(x = product_category, y = sales, fill = product_category)) +
  geom_bar(stat = "identity", show.legend = FALSE) +
  labs(
    title = "Sales of Healthy Product Categories for Medium Income",
    x = "Product Category",
    y = "Sales"
  ) +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_y_continuous(labels = scales::dollar_format())

Based off our graphs, we can find insights into what healthy products are doing better in different income ranges. Below are some insights across the board:

  • Soft Drinks are highly bought and sought after items, decrease the coupons made to promote healthier products and increase revenue for soft drinks.

  • There is a significant difference in the amount of fresh fruit consumed in low income households compared to medium and high income household. Increase the amount of coupons for fruit so low income households can have better opportunities to eat healthier

  • Yogurt is bought over 50 percent less in low income households than high income households

  • Candy is consistently in the top 25 bought items across all incomes

merged_data <- merge(transactions,products,by= "product_id")
coupon_merged <- merge(merged_data,coupon_redemptions,by="household_id")
top_coupons <- coupon_merged %>%
  group_by(coupon_upc)%>%
  group_by(product_category)%>%
  summarise(count=n())%>%
  arrange(-count)
top_coupons %>%
  head(10)%>% 
  ggplot(aes(x = reorder(product_category, -count), y = count)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(title = "Top 10 Coupon Uses", x = "Product Coupon", y = "Usage Count") +theme_minimal()

When analyzing the top healthy and unhealthy products based on sales it is crucial to understand the impact that coupons have on purchasing patterns. In our graph, it is evident that the top products that can be linked to coupons are bag snacks, fluid milk products, cheese, and soft drinks. Overall, this accounts for 2 of the top 5 healthy products and 2 of the top 5 unhealthy products, which can lead to understanding why those 4 products were listed as being top purchased products.

candy<-data.frame(product_category=c("CANDY - PACKAGED","CANDY - CHECKLINE"), total_sales=c(43680.94,16094.76))
 ggplot(candy,aes(x=product_category, y=total_sales))+geom_bar(stat="identity")+ labs(title="Packaged Candy vs Checkline Candy Sales", x="Candy", y="sales") +theme_minimal()

In our last analysis, we evaluated candy in the checkout line and candy that is packaged in the rest of the store. We prepared this analysis with the purpose of understanding the difference in packaged versus checkout-line candy as packaged candy is in the top 5 unhealthy products sold and check-line candy is not in the top 5. With further investigation, we found that check line candy accounts for less than 50% of the overall candy sold by the store.

High Income

high_income <- transactions %>% 
  inner_join(demographics) %>% 
  inner_join(products) %>%
  select(income,product_category, product_id) %>% 
  filter(income == c("100-124K", "125-149K", "150-174K", "175-199K", "200-249K", "250K+")) %>% 
  count(product_category) %>% 
  slice_max(order_by = n, n = 25) %>% 
  ggplot(aes(n, fct_reorder(product_category, n))) +
  geom_point(colour = "blue") + 
  labs(title = "Top 25 Products of High Income Households",
       subtitle = "") + 
  scale_x_continuous(name = "Total Number of Units Sold", labels = scales::comma) +
  scale_y_discrete(name = "Product Category")  +
  theme(axis.title.x = element_text(colour = "#0c4b99"),
        axis.title.y = element_text(colour = "#0c4b99"))
## Joining with `by = join_by(household_id)`
## Joining with `by = join_by(product_id)`
## Warning: There were 2 warnings in `filter()`.
## The first warning was:
## ℹ In argument: `==...`.
## Caused by warning in `==.default`:
## ! longer object length is not a multiple of shorter object length
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.

filteredhigh_df <- df %>%
  filter(
    product_category %in% target_categories,
    income == "175-199K"  
  ) %>%
  group_by(product_category) %>%
  summarise(sales = sum(sales_value, na.rm = TRUE)) %>%
  ungroup()
ggplot(filteredhigh_df, aes(x = product_category, y = sales, fill = product_category)) +
  geom_bar(stat = "identity", show.legend = FALSE) +
  labs(
    title = "Sales of Healthy Product Categories for High Income",
    x = "Product Category",
    y = "Sales"
  ) +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_y_continuous(labels = scales::dollar_format())

Based off our graphs, we can find insights into what healthy products are doing better in different income ranges. Below are some insights across the board:

  • Soft Drinks are highly bought and sought after items, decrease the coupons made to promote healthier products and increase revenue for soft drinks.

  • There is a significant difference in the amount of fresh fruit consumed in low income households compared to medium and high income household. Increase the amount of coupons for fruit so low income households can have better opportunities to eat healthier

  • Yogurt is bought over 50 percent less in low income households than high income households

  • Candy is consistently in the top 25 bought items across all incomes

merged_data <- merge(transactions,products,by= "product_id")
coupon_merged <- merge(merged_data,coupon_redemptions,by="household_id")
top_coupons <- coupon_merged %>%
  group_by(coupon_upc)%>%
  group_by(product_category)%>%
  summarise(count=n())%>%
  arrange(-count)
top_coupons %>%
  head(10)%>% 
  ggplot(aes(x = reorder(product_category, -count), y = count)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(title = "Top 10 Coupon Uses", x = "Product Coupon", y = "Usage Count") +theme_minimal()

When analyzing the top healthy and unhealthy products based on sales it is crucial to understand the impact that coupons have on purchasing patterns. In our graph, it is evident that the top products that can be linked to coupons are bag snacks, fluid milk products, cheese, and soft drinks. Overall, this accounts for 2 of the top 5 healthy products and 2 of the top 5 unhealthy products, which can lead to understanding why those 4 products were listed as being top purchased products.

candy<-data.frame(product_category=c("CANDY - PACKAGED","CANDY - CHECKLINE"), total_sales=c(43680.94,16094.76))
 ggplot(candy,aes(x=product_category, y=total_sales))+geom_bar(stat="identity")+ labs(title="Packaged Candy vs Checkline Candy Sales", x="Candy", y="sales") +theme_minimal()

In our last analysis, we evaluated candy in the checkout line and candy that is packaged in the rest of the store. We prepared this analysis with the purpose of understanding the difference in packaged versus checkout-line candy as packaged candy is in the top 5 unhealthy products sold and check-line candy is not in the top 5. With further investigation, we found that check line candy accounts for less than 50% of the overall candy sold by the store.

Summary

RSummary:

  • In conclusion we did find a correlation between top healthy and unhealthy food products and the demographics that buy them. From these insights we are able to provide recommendations to better increase sales and increase healthy shopping habits for low income households.

Recommendations:

  • Increase coupons for less popular products, like crackers which are a healthier alternative to bag snacks, to encourage sales.

  • Demographics recommendations: Decrease the coupons made for soft drinks to promote healthier habits and increase revenue as soft drinks are highly bought across all income ranges. Increase the amount of coupons for fruit so low income households can have better opportunities to eat healthier. Increase coupons for yogurt and vegetables as low income households have low sales in these product categories.

  • Decrease the amount of candy at the checkout line as candy throughout the rest of the store already accounts for the majority of the sales. Replace the candy with healthier options and even products that offer coupons to encourage sales at the checkout line.

Limitations:

  • Consumer habits are always changing, so when analyzing how we can promote healthier habits in consumer buying habits, we need the most relevant data and especially after significant events like the Covid 19 pandemic, this data might not be up to date or reliable in analyzing demographics and their consumer habits.

  • We based this analysis on income demographics and no other variables or other data sets. If we had more time we would have brought in other variables and maybe some other outside data sources to better find correlations and insights.