Project 2 — Data Tidying

Author

Kingsley Kojo Kpoku

Published

November 5, 2026

IMPORT LIBRARIES

Code
library(readr)
library(dplyr)
library(tidyr)
library(scales)
library(ggplot2)

DATA SOURCES

Code
## 1.NY HOUSING DATA - https://www.kaggle.com/datasets/nelgiriyewithana/new-york-housing-market

## 2.CARD ASSOCIATION ANALYSIS - Author-created illustrative data. Transaction counts and calculated percentages are hypothetical and are not actual card-network statistics.

## 3. TELECOMMUNICATION ANALYSIS - Author-created illustrative data. Transaction counts and calculated percentages are hypothetical and are not actual card-network statistics.

IMPORTING DATASET 1 - NY HOUSING ANALYSIS

Code
origfile_url_ <- "https://raw.githubusercontent.com/MrKpoku/Data-Acquistion-and-Mangement---Kingsley-Kojo-Kpoku/refs/heads/main/PROJECT%202/Project%202%20-%20NY_Housing.csv"

ny_housing <- readr::read_csv("https://raw.githubusercontent.com/MrKpoku/Data-Acquistion-and-Mangement---Kingsley-Kojo-Kpoku/refs/heads/main/PROJECT%202/Project%202%20-%20NY_Housing.csv")

## Checking the data

head(ny_housing)
# A tibble: 6 × 7
   Year Month Bronx Brooklyn Manhattan Queens `Staten Island`
  <dbl> <chr> <dbl>    <dbl>     <dbl>  <dbl>           <dbl>
1  2024 Jan     565      948      1108    650             675
2  2024 Feb     568      952      1112    654             678
3  2024 Mar     572      958      1118    660             683
4  2024 Apr     575      965      1122    663             688
5  2024 May     579      972      1128    668             693
6  2024 Jun     582      978      1132    671             697

CONVERTING THE COLUMNS

Code
ny_housing_long <- readr::read_csv(
  "Project 2 - NY_Housing.csv",
  show_col_types = FALSE
) |>
  dplyr::mutate(
    dplyr::across(
      -c(Year, Month),
      ~ readr::parse_number(as.character(.x))
    )
  ) |>
  tidyr::pivot_longer(
    cols = -c(Year, Month),
    names_to = "Borough",
    values_to = "Average_Price"
  )

head(ny_housing_long)
# A tibble: 6 × 4
   Year Month Borough       Average_Price
  <dbl> <chr> <chr>                 <dbl>
1  2024 Jan   Bronx                   565
2  2024 Jan   Brooklyn                948
3  2024 Jan   Manhattan              1108
4  2024 Jan   Queens                  650
5  2024 Jan   Staten Island           675
6  2024 Feb   Bronx                   568

REMOVING NULL VALUES

Code
colSums(is.na(ny_housing_long))
         Year         Month       Borough Average_Price 
            0             0             0             0 
Code
ny_housing_clean <- ny_housing_long |>
  dplyr::filter(!is.na(Average_Price))

ny_housing_clean <- na.omit(ny_housing_long)

ny_housing_clean <- ny_housing_long |>
  dplyr::select(where(~ !all(is.na(.x))))

View(ny_housing_clean)

head(ny_housing_clean)
# A tibble: 6 × 4
   Year Month Borough       Average_Price
  <dbl> <chr> <chr>                 <dbl>
1  2024 Jan   Bronx                   565
2  2024 Jan   Brooklyn                948
3  2024 Jan   Manhattan              1108
4  2024 Jan   Queens                  650
5  2024 Jan   Staten Island           675
6  2024 Feb   Bronx                   568

MOST EXPENSIVE BOROUGH NY

Code
expensive_borough <- ny_housing_long |>
  dplyr::group_by(Borough) |>
  dplyr::summarise(
    Average_Price = mean(Average_Price, na.rm = TRUE),
    .groups = "drop"
  ) |>
  dplyr::arrange(dplyr::desc(Average_Price))


expensive_borough
# A tibble: 5 × 2
  Borough       Average_Price
  <chr>                 <dbl>
1 Manhattan             1153.
2 Brooklyn              1000.
3 Staten Island          714.
4 Queens                 687.
5 Bronx                  595.
Code
## the most expensive borough on average price is manhattan. 

COMPARE YoY GROWTH

Code
yearly_summary <- ny_housing_long |>
  dplyr::group_by(Year, Borough) |>
  dplyr::summarise(
    Average_Price = mean(Average_Price, na.rm = TRUE),
    .groups = "drop"
  ) |>
  dplyr::arrange(Borough, Year) |>
  dplyr::group_by(Borough) |>
  dplyr::mutate(
    YoY_Growth_Rate = (Average_Price / dplyr::lag(Average_Price) - 1) * 100
  ) |>
  dplyr::ungroup() |>
  dplyr::arrange(Year, dplyr::desc(Average_Price))


yearly_summary
# A tibble: 10 × 4
    Year Borough       Average_Price YoY_Growth_Rate
   <dbl> <chr>                 <dbl>           <dbl>
 1  2024 Manhattan             1130.           NA   
 2  2024 Brooklyn               975            NA   
 3  2024 Staten Island          696.           NA   
 4  2024 Queens                 670.           NA   
 5  2024 Bronx                  581.           NA   
 6  2025 Manhattan             1175.            3.93
 7  2025 Brooklyn              1025.            5.15
 8  2025 Staten Island          733.            5.44
 9  2025 Queens                 704             5.13
10  2025 Bronx                  609.            4.84

VISUALIZATION - YoY GROWTH RATE

Code
ggplot(yearly_summary, aes(x = Borough, y = YoY_Growth_Rate, fill = factor(Borough))) +
  geom_col(position = "dodge") +
  labs(
    title = "YoY_Growth_Rate by Borough and Year",
    x = "Borough",
    y = "YoY_Growth_Rate",
    fill = "Borough"
  ) +
  theme_minimal()

Code
## there is an increase in the average prices on the boroughs through the years and what is expected. However based on the YOY Growth rate staten island had the fastest growth rate with 5.4.

COMPARE MONTHLY AVERAGES

Code
month_order <- c(
  "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
)

monthly_summary <- ny_housing_long |>
  dplyr::mutate(
    Month = factor(Month, levels = month_order)
  ) |>
  dplyr::group_by(Month, Borough) |>
  dplyr::summarise(
    Average_Price = mean(Average_Price, na.rm = TRUE),
    .groups = "drop"
  ) |>
  dplyr::arrange(Month, Borough)

monthly_summary
# A tibble: 60 × 3
   Month Borough       Average_Price
   <fct> <chr>                 <dbl>
 1 Jan   Bronx                  580.
 2 Jan   Brooklyn               974.
 3 Jan   Manhattan             1130.
 4 Jan   Queens                 669 
 5 Jan   Staten Island          695 
 6 Feb   Bronx                  582.
 7 Feb   Brooklyn               978.
 8 Feb   Manhattan             1134 
 9 Feb   Queens                 672.
10 Feb   Staten Island          698 
# ℹ 50 more rows

VISUALIZATION - MONTHLY AVERAGES

Code
## GENERAL MONTHLY ANALYSIS

ggplot(
  monthly_summary,
  aes(x = Month, y = Average_Price, color = Borough, group = Borough)
) +
  geom_line(linewidth = 1) +
  geom_point(size = 2) +
  labs(
    title = "Average Housing Price by Month and Borough",
    x = "Month",
    y = "Average Price",
    color = "Borough"
  ) +
  theme_minimal()

Code
## 2024 ANALYSIS

month_order <- c(
  "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
)

ny_housing_long |>
  dplyr::filter(Year == 2024) |>
  dplyr::mutate(
    Month = factor(Month, levels = month_order)
  ) |>
  dplyr::group_by(Year, Month, Borough) |>
  dplyr::summarise(
    Average_Price = mean(Average_Price, na.rm = TRUE),
    .groups = "drop"
  ) |>
  ggplot2::ggplot(
    ggplot2::aes(
      x = Month,
      y = Average_Price,
      color = Borough,
      group = Borough
    )
  ) +
  ggplot2::geom_line(linewidth = 1) +
  ggplot2::geom_point(size = 2) +
  ggplot2::labs(
    title = "Average Housing Prices by Month — 2024",
    x = "Month",
    y = "Average Price",
    color = "Borough"
  ) +
  ggplot2::theme_minimal()

Code
## 2025 ANALYSIS

ny_housing_long |>
  dplyr::filter(.data$Year == 2025) |>
  dplyr::mutate(
    Month = factor(
      Month,
      levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  dplyr::group_by(Year, Month, Borough) |>
  dplyr::summarise(
    Average_Price = mean(Average_Price, na.rm = TRUE),
    .groups = "drop"
  ) |>
  ggplot2::ggplot(
    ggplot2::aes(
      x = Month,
      y = Average_Price,
      color = Borough,
      group = Borough
    )
  ) +
  ggplot2::geom_line(linewidth = 1) +
  ggplot2::geom_point(size = 2) +
  ggplot2::labs(
    title = "Average Housing Prices by Month — 2025",
    x = "Month",
    y = "Average Price",
    color = "Borough"
  ) +
  ggplot2::theme_minimal()

CONCLUSION AND ANALYTICS FINDING

1.Average housing prices increased across all five boroughs from 2024 to 2025. Staten Island had the highest year-over-year (YoY) growth rate at 5.4%, while Manhattan had the lowest. This shows that prices grew fastest in Staten Island in this data set; price growth alone does not show that more residents moved there.

2. Manhattan remains the most expensive borough, as expected, so customers considering it should plan for a higher budget and compare housing options carefully. Staten Island had the highest year-over-year growth rate in the sample, suggesting that its prices increased the fastest from 2024 to 2025 and may continue to attract buyer interest. These recommendations are based on simulated data, so customers should check current market information before making a real purchase.

3. Real estate Analyst Advice
As a real estate analyst, I would advise customers interested in Brooklyn to compare current properties with their budget and needs, and to consider acting sooner if they find a suitable property. In this sample, Brooklyn’s average prices rose over the period analyzed, which may indicate increasing costs for buyers if that pattern continues. However, the data shows past average prices, not future prices. Monthly averages can also change when the mix of properties sold changes—for example, if more high-priced homes sell in one month. Buyers should therefore consider individual property condition, location, financing costs, and recent comparable sales rather than relying on borough averages alone. Rising prices are not guaranteed to continue.

IMPORTING DATASET 2 - CARD ASSOCIATION ANALYSIS

Code
origfile_url_ <- "https://raw.githubusercontent.com/MrKpoku/Data-Acquistion-and-Mangement---Kingsley-Kojo-Kpoku/refs/heads/main/PROJECT%202/Card_Association_V1.csv"

card_association <- readr::read_csv("https://raw.githubusercontent.com/MrKpoku/Data-Acquistion-and-Mangement---Kingsley-Kojo-Kpoku/refs/heads/main/PROJECT%202/Card_Association_V1.csv")

## Checking the data

head(card_association)
# A tibble: 6 × 16
  month  year visa_transactions_millions mastercard_transactions_millions
  <chr> <dbl>                      <dbl>                            <dbl>
1 Jan    2025                        200                              100
2 Feb    2025                        250                              150
3 Mar    2025                        100                              120
4 Apr    2025                         50                               70
5 May    2025                         80                              100
6 Jun    2025                        130                              140
# ℹ 12 more variables: amex_transactions_millions <dbl>,
#   discover_transactions_millions <dbl>, total_transactions_millions <dbl>,
#   `visa_share_%` <dbl>, `mastercard_share_%` <dbl>, `amex_share_%` <dbl>,
#   `discover_share_%` <dbl>, ...12 <lgl>, ...13 <lgl>, ...14 <lgl>,
#   ...15 <lgl>, ...16 <lgl>

CONVERTING THE COLUMNS

Code
card_association_2 <- card_association |>
  pivot_longer(
    cols = c(
      visa_transactions_millions,
      mastercard_transactions_millions,
      amex_transactions_millions,
      discover_transactions_millions
    ),
    names_to = "network",
    names_pattern = "(.*)_transactions_millions",
    values_to = "transactions_millions"
  ) |>
  mutate(
    network = recode(
      network,
      visa = "Visa",
      mastercard = "Mastercard",
      amex = "American Express",
      discover = "Discover"
    )
  ) |>
  select(
    month,
    year,
    network,
    transactions_millions
  )

head(card_association_2)
# A tibble: 6 × 4
  month  year network          transactions_millions
  <chr> <dbl> <chr>                            <dbl>
1 Jan    2025 Visa                               200
2 Jan    2025 Mastercard                         100
3 Jan    2025 American Express                   150
4 Jan    2025 Discover                           180
5 Feb    2025 Visa                               250
6 Feb    2025 Mastercard                         150

EXPLORATORY ANALYSIS - NETWORK VS TRANSACTIONS

Code
network_totals <- card_association_2 |>
  group_by(network) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    percent_contribution =
      round(transactions_millions / sum(transactions_millions) * 100, 2),
    transactions_millions = comma(transactions_millions, accuracy = 1)
  ) |>
  arrange(desc(as.numeric(gsub(",", "", transactions_millions))))

network_totals
# A tibble: 4 × 3
  network          transactions_millions percent_contribution
  <chr>            <chr>                                <dbl>
1 American Express 1,680                                 27.4
2 Discover         1,512                                 24.6
3 Visa             1,510                                 24.6
4 Mastercard       1,431                                 23.3

VISUALIZATION - NETWORK VS TRANSACTIONS

Code
network_totals <- card_association_2 |>
  group_by(network) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    percent_contribution =
      transactions_millions / sum(transactions_millions) * 100
  ) |>
  arrange(desc(transactions_millions))

ggplot(
  network_totals,
  aes(
    x = reorder(network, transactions_millions),
    y = transactions_millions,
    fill = network
  )
) +
  geom_col(show.legend = FALSE) +
  geom_text(
    aes(
      label = paste0(
        comma(transactions_millions, accuracy = 1),
        " (", round(percent_contribution, 2), "%)"
      )
    ),
    hjust = -0.1,
    size = 3.5
  ) +
  coord_flip() +
  scale_y_continuous(
    labels = comma,
    expand = expansion(mult = c(0, 0.2))
  ) +
  labs(
    title = "Total Transactions by Card Network",
    x = "Card network",
    y = "Transactions (millions)"
  ) +
  theme_minimal()

MONTHLY ANALYSIS ON TRANSACTIONS

Code
## GENERAL MONTH ON MONTH PERFORMANCE OF THE CARD ASSOCATIONS


monthly_growth <- card_association_2 |>
  group_by(year, month) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    month_number = match(
      month,
      c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  arrange(year, month_number) |>
  mutate(
    previous_month_transactions = lag(transactions_millions),
    mom_growth_pct = round(
      (transactions_millions - previous_month_transactions) /
        previous_month_transactions * 100,
      2
    )
  ) |>
  select(
    month,
    previous_month_transactions,
    mom_growth_pct
  )

monthly_growth
# A tibble: 13 × 3
   month previous_month_transactions mom_growth_pct
   <chr>                       <dbl>          <dbl>
 1 Jan                            NA           NA  
 2 Feb                           630           54.0
 3 Mar                           970          -48.4
 4 Apr                           500          -48  
 5 May                           260           69.2
 6 Jun                           440           23.2
 7 Jul                           542           16.4
 8 Aug                           631          -28.7
 9 Sep                           450          -31.1
10 Oct                           310           74.2
11 Nov                           540          -25.9
12 Dec                           400           15  
13 <NA>                          460         -100  
Code
## LETS STUDY THE MoM ANALYSIS - AMERICAN EXPRESS CARD

amex_monthly_growth <- card_association_2 |>
  filter(network == "American Express") |>
  group_by(year, month) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    month_number = match(
      month,
      c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  arrange(year, month_number) |>
  mutate(
    previous_month_transactions = lag(transactions_millions),
    mom_growth_pct =
      (transactions_millions - previous_month_transactions) /
      previous_month_transactions * 100
  ) |>
  select(
    month,
    previous_month_transactions,
    mom_growth_pct
  )

amex_monthly_growth
# A tibble: 13 × 3
   month previous_month_transactions mom_growth_pct
   <chr>                       <dbl>          <dbl>
 1 Jan                            NA           NA  
 2 Feb                           150          133. 
 3 Mar                           350          -62.9
 4 Apr                           130          -53.8
 5 May                            60          100  
 6 Jun                           120           25  
 7 Jul                           150           33.3
 8 Aug                           200          -35  
 9 Sep                           130          -30.8
10 Oct                            90            0  
11 Nov                            90            0  
12 Dec                            90           33.3
13 <NA>                          120         -100  
Code
## LETS STUDY THE MoM ANALYSIS - DISCOVER CARD

discover_monthly_growth <- card_association_2 |>
  filter(network == "Discover") |>
  group_by(year, month) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    month_number = match(
      month,
      c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  arrange(year, month_number) |>
  mutate(
    previous_month_transactions = lag(transactions_millions),
    mom_growth_pct =
      (transactions_millions - previous_month_transactions) /
      previous_month_transactions * 100
  ) |>
  select(
    month,
    previous_month_transactions,
    mom_growth_pct
  )

discover_monthly_growth
# A tibble: 13 × 3
   month previous_month_transactions mom_growth_pct
   <chr>                       <dbl>          <dbl>
 1 Jan                            NA          NA   
 2 Feb                           180          22.2 
 3 Mar                           220         -31.8 
 4 Apr                           150         -46.7 
 5 May                            80          75   
 6 Jun                           140         -12.9 
 7 Jul                           122         -18.0 
 8 Aug                           100           0   
 9 Sep                           100          10   
10 Oct                           110          -9.09
11 Nov                           100         -20   
12 Dec                            80          62.5 
13 <NA>                          130        -100   
Code
## LETS STUDY THE MoM ANALYSIS - VISA CARD

visa_monthly_growth <- card_association_2 |>
  filter(network == "Visa") |>
  group_by(year, month) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    month_number = match(
      month,
      c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  arrange(year, month_number) |>
  mutate(
    previous_month_transactions = lag(transactions_millions),
    mom_growth_pct =
      (transactions_millions - previous_month_transactions) /
      previous_month_transactions * 100
  ) |>
  select(
    month,
    previous_month_transactions,
    mom_growth_pct
  )

visa_monthly_growth
# A tibble: 13 × 3
   month previous_month_transactions mom_growth_pct
   <chr>                       <dbl>          <dbl>
 1 Jan                            NA           NA  
 2 Feb                           200           25  
 3 Mar                           250          -60  
 4 Apr                           100          -50  
 5 May                            50           60  
 6 Jun                            80           62.5
 7 Jul                           130           23.1
 8 Aug                           160          -37.5
 9 Sep                           100          -50  
10 Oct                            50          240  
11 Nov                           170          -29.4
12 Dec                           120          -16.7
13 <NA>                          100         -100  
Code
## LETS STUDY THE MoM ANALYSIS - MASTERCARD

master_monthly_growth <- card_association_2 |>
  filter(network == "Mastercard") |>
  group_by(year, month) |>
  summarise(
    transactions_millions = sum(transactions_millions, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(
    month_number = match(
      month,
      c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  arrange(year, month_number) |>
  mutate(
    previous_month_transactions = lag(transactions_millions),
    mom_growth_pct =
      (transactions_millions - previous_month_transactions) /
      previous_month_transactions * 100
  ) |>
  select(
    month,
    previous_month_transactions,
    mom_growth_pct
  )

master_monthly_growth
# A tibble: 13 × 3
   month previous_month_transactions mom_growth_pct
   <chr>                       <dbl>          <dbl>
 1 Jan                            NA           NA  
 2 Feb                           100           50  
 3 Mar                           150          -20  
 4 Apr                           120          -41.7
 5 May                            70           42.9
 6 Jun                           100           40  
 7 Jul                           140           22.1
 8 Aug                           171          -29.8
 9 Sep                           120          -50  
10 Oct                            60          200  
11 Nov                           180          -38.9
12 Dec                           110            0  
13 <NA>                          110         -100  

VISUALIZATION - MONTHLY ANALYSIS ON TRANSACTIONS

Code
## GENERAL PERFORMANCE ANALYSIS

monthly_growth |>
  filter(!is.na(month), !is.na(mom_growth_pct)) |>
  mutate(
    month = factor(
      month,
      levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  ggplot(aes(x = month, y = mom_growth_pct, group = 1)) +
  geom_hline(yintercept = 0, color = "gray60", linetype = "dashed") +
  geom_line(color = "#2878B5", linewidth = 1) +
  geom_point(color = "#2878B5", size = 3) +
  scale_y_continuous(labels = label_percent(scale = 1)) +
  labs(
    title = "Month-over-Month Transaction Growth",
    x = "Month",
    y = "Growth from previous month (%)"
  ) +
  theme_minimal()

Code
##  MoM AMERICAN EXPRESS VISUALIZATION PERFORMANCE

amex_monthly_growth |>
  filter(!is.na(month), !is.na(mom_growth_pct)) |>
  mutate(
    month = factor(
      month,
      levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  ggplot(aes(x = month, y = mom_growth_pct, group = 1)) +
  geom_hline(yintercept = 0, color = "gray60", linetype = "dashed") +
  geom_line(color = "#2878B5", linewidth = 1) +
  geom_point(color = "#2878B5", size = 3) +
  scale_y_continuous(labels = label_percent(scale = 1)) +
  labs(
    title = "AMEX Month-over-Month Transaction Growth",
    x = "Month",
    y = "Growth from previous month (%)"
  ) +
  theme_minimal()

Code
##  MoM DISCOVER CARD VISUALIZATION PERFORMANCE

discover_monthly_growth |>
  filter(!is.na(month), !is.na(mom_growth_pct)) |>
  mutate(
    month = factor(
      month,
      levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  ggplot(aes(x = month, y = mom_growth_pct, group = 1)) +
  geom_hline(yintercept = 0, color = "gray60", linetype = "dashed") +
  geom_line(color = "#2878B5", linewidth = 1) +
  geom_point(color = "#2878B5", size = 3) +
  scale_y_continuous(labels = label_percent(scale = 1)) +
  labs(
    title = "Discover Month-over-Month Transaction Growth",
    x = "Month",
    y = "Growth from previous month (%)"
  ) +
  theme_minimal()

Code
##  MoM VISA CARD VISUALIZATION PERFORMANCE

visa_monthly_growth |>
  filter(!is.na(month), !is.na(mom_growth_pct)) |>
  mutate(
    month = factor(
      month,
      levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  ggplot(aes(x = month, y = mom_growth_pct, group = 1)) +
  geom_hline(yintercept = 0, color = "gray60", linetype = "dashed") +
  geom_line(color = "#2878B5", linewidth = 1) +
  geom_point(color = "#2878B5", size = 3) +
  scale_y_continuous(labels = label_percent(scale = 1)) +
  labs(
    title = "Visa Month-over-Month Transaction Growth",
    x = "Month",
    y = "Growth from previous month (%)"
  ) +
  theme_minimal()

Code
##  MoM MASTERCARD VISUALIZATION PERFORMANCE

master_monthly_growth |>
  filter(!is.na(month), !is.na(mom_growth_pct)) |>
  mutate(
    month = factor(
      month,
      levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    )
  ) |>
  ggplot(aes(x = month, y = mom_growth_pct, group = 1)) +
  geom_hline(yintercept = 0, color = "gray60", linetype = "dashed") +
  geom_line(color = "#2878B5", linewidth = 1) +
  geom_point(color = "#2878B5", size = 3) +
  scale_y_continuous(labels = label_percent(scale = 1)) +
  labs(
    title = "Mastercard Month-over-Month Transaction Growth",
    x = "Month",
    y = "Growth from previous month (%)"
  ) +
  theme_minimal()

CONCLUSION AND ANALYTICS FINDING

1.American Express recorded the highest share of transactions at 27.39%, while Mastercard had the lowest share at 23.33%. The difference is 4.06 percentage points, so the distribution is relatively balanced across the card networks in this data set. No single network accounts for a dominant share of transactions, suggesting that the market is not concentrated in one network.

2. The month-over-month charts show that no card network had consistently positive growth across the year. All four networks experienced both increases and declines, with a notable spike in October for Visa and MasterCard. American Express had the largest visible increase in February, followed by a sharp decline in March. Discover’s changes appear less extreme than the others overall, though it also had sizable increases in May and December.

3.Based on month-over-month growth, American Express and Discover showed strong gains in some months, while Visa and MasterCard had especially large October increases.

IMPORTING DATASET 3 - TELECOMMUNICATION ANALYSIS

Code
## DATASET 3 - TELECOMMUNICATION ANALYSIS

origfile_url_ <- "https://raw.githubusercontent.com/MrKpoku/Data-Acquistion-and-Mangement---Kingsley-Kojo-Kpoku/refs/heads/main/PROJECT%202/Tele_Data.csv"

tele_comm <- readr::read_csv("https://raw.githubusercontent.com/MrKpoku/Data-Acquistion-and-Mangement---Kingsley-Kojo-Kpoku/refs/heads/main/PROJECT%202/Tele_Data.csv")

## Checking the data

head(tele_comm)
# A tibble: 6 × 17
  customer_id Customer_Name Gender `Monthly Charges` Churn   Jan   Feb   Mar
        <dbl> <chr>         <chr>              <dbl> <chr> <dbl> <dbl> <dbl>
1         101 Kingsley      Male                29.8 Yes      12    15    11
2         102 Patricia      Female              57.0 No        8    10     9
3         103 Jasmine       Female              53.8 No        9     7    15
4         104 Donald        Male                42.3 No       12     4     6
5         105 Juliet        Female              70.7 Yes      11    14    16
6         106 Kian          Male                99.6 No       11    11    12
# ℹ 9 more variables: Apr <dbl>, May <dbl>, Jun <dbl>, Jul <dbl>, Aug <dbl>,
#   Sep <dbl>, Oct <dbl>, Nov <dbl>, Dec <dbl>

CONVERTING THE COLUMNS

Code
tele_comm2 <- tele_comm %>%
  pivot_longer(
    cols = Jan:Dec,
    names_to = "Months",
    values_to = "Counts_Calls"
  )

tele_comm2
# A tibble: 168 × 7
   customer_id Customer_Name Gender `Monthly Charges` Churn Months Counts_Calls
         <dbl> <chr>         <chr>              <dbl> <chr> <chr>         <dbl>
 1         101 Kingsley      Male                29.8 Yes   Jan              12
 2         101 Kingsley      Male                29.8 Yes   Feb              15
 3         101 Kingsley      Male                29.8 Yes   Mar              11
 4         101 Kingsley      Male                29.8 Yes   Apr              14
 5         101 Kingsley      Male                29.8 Yes   May              12
 6         101 Kingsley      Male                29.8 Yes   Jun              22
 7         101 Kingsley      Male                29.8 Yes   Jul              14
 8         101 Kingsley      Male                29.8 Yes   Aug              13
 9         101 Kingsley      Male                29.8 Yes   Sep              11
10         101 Kingsley      Male                29.8 Yes   Oct              10
# ℹ 158 more rows

EXPLORATORY ANALYSIS

Code
names(tele_comm2)
[1] "customer_id"     "Customer_Name"   "Gender"          "Monthly Charges"
[5] "Churn"           "Months"          "Counts_Calls"   
Code
customer_summary <- tele_comm2 |>
  group_by(Customer_Name, Gender, `Monthly Charges`, Churn) |>
  summarise(
    counts_calls = sum(Counts_Calls, na.rm = TRUE),
    .groups = "drop"
  )

## RENAMING CUSTOMER_NAME COLUMN TO EMPLOYEE_NAME
tele_comm2 <- tele_comm2 |>
  rename(Employee_Name =Customer_Name)

tele_comm2 <- tele_comm2 |>
  rename(Customer_Name =Employee_Name)

customer_summary
# A tibble: 11 × 5
   Customer_Name Gender `Monthly Charges` Churn counts_calls
   <chr>         <chr>              <dbl> <chr>        <dbl>
 1 Alfred        Male               105.  Yes            170
 2 Donald        Male                42.3 No             147
 3 Jasmine       Female              53.8 No             194
 4 Juliet        Female              70.7 Yes            143
 5 Kaira         Female              89.1 Yes            162
 6 Kian          Male                99.6 No             177
 7 Kingsley      Male                29.8 Yes            173
 8 Obed          Male                29.8 No             182
 9 Patricia      Female              57.0 No             191
10 Renee         Female              56.2 Yes            180
11 <NA>          <NA>                NA   <NA>             0
Code
## CUSTOMER_NAME VS COUNTS_CALLS ANALYSIS

customer_call_totals <- tele_comm2 |>
  group_by(Customer_Name) |>
  summarise(
    total_calls = sum(Counts_Calls, na.rm = TRUE),
    .groups = "drop"
  ) |>
  arrange(desc(total_calls))

customer_call_totals
# A tibble: 11 × 2
   Customer_Name total_calls
   <chr>               <dbl>
 1 Jasmine               194
 2 Patricia              191
 3 Obed                  182
 4 Renee                 180
 5 Kian                  177
 6 Kingsley              173
 7 Alfred                170
 8 Kaira                 162
 9 Donald                147
10 Juliet                143
11 <NA>                    0
Code
## jasmine recorded the highest number of calls made for the company. considerations should be made to reward her 

## GENDER  VS MONTHLY CHARGES ANALYSIS

gender_charges <- tele_comm2 |>
  group_by(Gender) |>
  summarise(
    average_monthly_charge = mean(`Monthly Charges`, na.rm = TRUE),
    .groups = "drop"
  ) |>
  arrange(desc(average_monthly_charge))

gender_charges
# A tibble: 3 × 2
  Gender average_monthly_charge
  <chr>                   <dbl>
1 Female                   65.4
2 Male                     61.3
3 <NA>                    NaN  
Code
## averagely females paid more charges to the telcos than males.can you base this on movies ? 

VISUALIZATIONS

Code
## CUSTOMER_NAME VS COUNTS_CALLS ANALYSIS

ggplot(
  customer_call_totals,
  aes(
    x = reorder(Customer_Name, total_calls),
    y = total_calls
  )
) +
  geom_col(fill = "#2878B5") +
  coord_flip() +
  labs(
    title = "Total Calls by Customer",
    x = "Customer",
    y = "Total calls"
  ) +
  theme_minimal()

Code
## GENDER  VS MONTHLY CHARGES ANALYSIS

ggplot(
  gender_charges,
  aes(
    x = reorder(Gender, average_monthly_charge),
    y = average_monthly_charge,
    fill = Gender
  )
) +
  geom_col(show.legend = FALSE) +
  geom_text(
    aes(label = sprintf("$%.2f", average_monthly_charge)),
    hjust = -0.15
  ) +
  coord_flip() +
  scale_y_continuous(
    labels = scales::dollar_format(),
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(
    title = "Average Monthly Charges by Gender",
    x = "Gender",
    y = "Average monthly charge (USD)"
  ) +
  theme_minimal()

CONCLUSION AND ANALYTICS FINDING

Kingsley Connect Telecom should use these findings to explore customer engagement and plan value. Jasmine’s high call activity may make her a good candidate for a loyalty incentive, such as bonus minutes or a reward for continued use. The company could also test introductory calling bundles for customers with low call activity, while first checking whether those customers use other services or simply prefer different ways to communicate. Incentives should be evaluated to see whether they increase call activity and customer retention.

Female customers had higher average monthly charges than male customers in this sample. This could reflect differences in subscribed plans, service add-ons, data use, or customer mix, but the current analysis does not establish the reason. Kingsley Connect Telecom should compare those factors across groups before making pricing or marketing decisions, and ensure offers are based on customer needs and service usage rather than assumptions about gender.

These recommendations are starting points for further analysis. The results cover the customers and period in the dataset, so they should not be treated as proof of broader customer behavior without checking the sample size, time period, and underlying billing details.