library(readxl)
## Warning: package 'readxl' was built under R version 4.4.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
library(plotly)
## Warning: package 'plotly' was built under R version 4.4.3
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(lubridate)
## Warning: package 'lubridate' was built under R version 4.4.3
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
df <- read_excel("data_retail_clean_Part27.xlsx")
country_counts <- df %>%
count(country, sort = TRUE)
top10 <- df %>%
count(country, sort = TRUE) %>%
head(10)
top10 <- top10 %>%
mutate(group = ifelse(country == "United Kingdom", "UK", "Other"))
plot_ly(
data = top10,
x = ~n,
y = ~reorder(country, n),
type = "bar",
orientation = "h",
color = ~group,
colors = c("UK" = "orange", "Other" = "steelblue"),
text = ~paste(
"Negara:", country,
"<br>Jumlah Transaksi:", n
),
hoverinfo = "text",
textposition = "none"
) %>%
layout(
hoverlabel = list(
bgcolor = "black",
font = list(color = "white")
)
)
Visualisasi menunjukkan bahwa United Kingdom memiliki jumlah transaksi yang sangat dominan dibandingkan negara lainnya. Perbedaan yang terlihat sangat signifikan ini menandakan bahwa sebagian besar aktivitas transaksi berasal dari UK. Negara-negara lain memang muncul dalam Top 10, namun kontribusinya relatif kecil jika dibandingkan dengan UK.
top10_no_uk <- top10 %>%
filter(country != "United Kingdom")
plot_ly(
data = top10_no_uk,
x = ~n,
y = ~reorder(country, n),
type = "bar",
orientation = "h",
marker = list(color = "steelblue"),
text = ~paste(
"Negara:", country,
"<br>Jumlah Transaksi:", n
),
hoverinfo = "text",
textposition = "none"
) %>%
layout(
hoverlabel = list(
bgcolor = "black",
font = list(color = "white")
)
)
Setelah United Kingdom dikeluarkan dari visualisasi, terlihat bahwa distribusi transaksi antar negara menjadi lebih merata. Beberapa negara seperti Germany, France, dan Netherlands muncul sebagai kontributor utama di pasar internasional. Perbedaan antar negara tidak terlalu ekstrem, menunjukkan bahwa tidak ada satu negara lain yang benar-benar mendominasi seperti UK.
Berdasarkan kedua visualisasi, dapat disimpulkan bahwa bisnis ini masih sangat bergantung pada pasar United Kingdom sebagai sumber utama transaksi. Dominasi UK yang sangat signifikan menunjukkan bahwa aktivitas bisnis belum tersebar secara merata secara global.
Setelah UK dikeluarkan dari analisis, terlihat bahwa pasar internasional masih bersifat tersebar tanpa adanya dominasi yang kuat dari negara lain. Hal ini menunjukkan bahwa potensi ekspansi global masih sangat besar dan belum dimanfaatkan secara optimal.