This report analyzes International Breweries’ performance
over the past three years.
It focuses on profit trends across Anglophone and Francophone
territories, helping management (Mr. Stone) make strategic
decisions to maximize profit and minimize loss.
df <- read.csv("C:\\Users\\user\\Desktop\\International-Breweries.csv", stringsAsFactors = FALSE)
# Clean columns
colnames(df) <- trimws(colnames(df))
df$PROFIT <- as.numeric(df$PROFIT)
df$YEARS <- as.numeric(df$YEARS)
df$MONTHS <- trimws(df$MONTHS)
# Define language territories
anglophone <- c("Nigeria", "Ghana", "Sierra Leone", "Liberia", "Gambia")
francophone <- c("Benin", "Togo", "Senegal", "Côte d'Ivoire", "Cameroon")
df$TERRITORY_LANG <- ifelse(df$COUNTRIES %in% anglophone, "Anglophone",
ifelse(df$COUNTRIES %in% francophone, "Francophone", "Unclassified"))
head(df)
## SALES_ID SALES_REP EMAILS BRANDS PLANT_COST UNIT_PRICE
## 1 10101 Jardine jard@gmail.com trophy 150 200
## 2 10102 Gill gillhell@uk.com budweiser 250 500
## 3 10103 Sorvino sorvi2000@gmail.com castle lite 180 450
## 4 10104 Jones jone.ai@yahoo.com eagle lager 170 250
## 5 10105 Andrews andy@gmail.com hero 150 200
## 6 10106 Jardine jard@gmail.com beta malt 80 150
## QUANTITY COST PROFIT COUNTRIES REGION MONTHS YEARS TERRITORY_LANG
## 1 725 145000 36250 Ghana Southeast January 2019 Anglophone
## 2 815 407500 203750 Nigeria west February 2018 Anglophone
## 3 937 421650 252990 Togo southsouth March 2018 Francophone
## 4 765 191250 61200 Benin northwest April 2018 Francophone
## 5 836 167200 41800 Senegal northeast May 2017 Francophone
## 6 798 119700 55860 Ghana northcentral June 2019 Anglophone
total_profit_all <- sum(df$PROFIT, na.rm = TRUE)
paste("Total Profit (All Territories, 3 Years): ₦", format(total_profit_all, big.mark = ","))
## [1] "Total Profit (All Territories, 3 Years): ₦ 105,587,420"
profit_by_lang <- df %>%
group_by(TERRITORY_LANG) %>%
summarise(TOTAL_PROFIT = sum(PROFIT, na.rm = TRUE))
profit_by_lang
## # A tibble: 2 × 2
## TERRITORY_LANG TOTAL_PROFIT
## <chr> <dbl>
## 1 Anglophone 42389260
## 2 Francophone 63198160
# Visualization
ggplot(profit_by_lang, aes(x = TERRITORY_LANG, y = TOTAL_PROFIT, fill = TERRITORY_LANG)) +
geom_bar(stat = "identity") +
theme_minimal() +
labs(title = "Total Profit by Territory Language (3 Years)", y = "Profit", x = "Territory")
top_country_2019 <- df %>%
filter(YEARS == 2019) %>%
group_by(COUNTRIES) %>%
summarise(TOTAL_PROFIT = sum(PROFIT, na.rm = TRUE)) %>%
arrange(desc(TOTAL_PROFIT)) %>%
head(1)
top_country_2019
## # A tibble: 1 × 2
## COUNTRIES TOTAL_PROFIT
## <chr> <dbl>
## 1 Ghana 7144070
profit_by_year <- df %>%
group_by(YEARS) %>%
summarise(TOTAL_PROFIT = sum(PROFIT, na.rm = TRUE)) %>%
arrange(desc(TOTAL_PROFIT))
profit_by_year
## # A tibble: 3 × 2
## YEARS TOTAL_PROFIT
## <dbl> <dbl>
## 1 2017 38503320
## 2 2018 37063850
## 3 2019 30020250
least_profit_month <- df %>%
group_by(MONTHS) %>%
summarise(TOTAL_PROFIT = sum(PROFIT, na.rm = TRUE)) %>%
arrange(TOTAL_PROFIT) %>%
head(1)
least_profit_month
## # A tibble: 1 × 2
## MONTHS TOTAL_PROFIT
## <chr> <dbl>
## 1 April 8573830
min_profit_dec_2018 <- df %>%
filter(MONTHS == "December", YEARS == 2018) %>%
summarise(MIN_PROFIT = min(PROFIT, na.rm = TRUE))
min_profit_dec_2018
## MIN_PROFIT
## 1 38150
profit_month_2019 <- df %>%
filter(YEARS == 2019) %>%
group_by(MONTHS) %>%
summarise(PROFIT = sum(PROFIT, na.rm = TRUE)) %>%
mutate(PERCENT_OF_2019 = (PROFIT / sum(PROFIT)) * 100) %>%
arrange(desc(PERCENT_OF_2019))
profit_month_2019
## # A tibble: 12 × 3
## MONTHS PROFIT PERCENT_OF_2019
## <chr> <dbl> <dbl>
## 1 January 3263160 10.9
## 2 August 2982800 9.94
## 3 July 2945340 9.81
## 4 April 2851470 9.50
## 5 November 2675610 8.91
## 6 June 2669080 8.89
## 7 May 2573040 8.57
## 8 March 2530620 8.43
## 9 October 2220870 7.40
## 10 December 2048780 6.82
## 11 September 1892600 6.30
## 12 February 1366880 4.55
# Visualization
ggplot(profit_month_2019, aes(x = reorder(MONTHS, -PERCENT_OF_2019), y = PERCENT_OF_2019)) +
geom_bar(stat = "identity", fill = "steelblue") +
theme_minimal() +
labs(title = "Profit Percentage by Month (2019)", x = "Month", y = "Percentage (%)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
top_brand_senegal <- df %>%
filter(trimws(tolower(COUNTRIES)) == "senegal") %>%
group_by(BRANDS) %>%
summarise(TOTAL_PROFIT = sum(PROFIT, na.rm = TRUE)) %>%
arrange(desc(TOTAL_PROFIT)) %>%
head(1)
top_brand_senegal
## # A tibble: 1 × 2
## BRANDS TOTAL_PROFIT
## <chr> <dbl>
## 1 castle lite 7012980