library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.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(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.1     ✔ stringr   1.5.2
## ✔ lubridate 1.9.4     ✔ tibble    3.3.0
## ✔ purrr     1.1.0     ✔ tidyr     1.3.1
## ✔ readr     2.1.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Data <- read.table(file.choose(), 
                   header = TRUE, 
                   sep = "\t", 
                   fill = TRUE, 
                   strip.white = TRUE)
Data$Haji <- as.numeric(gsub("\\.", "", Data$Haji))

ggplot(Data, aes(x = Haji)) + 
  geom_histogram(binwidth = 5000, boundary = 0, fill = "Pink", color = "Black") + 
  labs(
    title = "Distribusi Jumlah Jemaah Haji di Indonesia 2025", 
    x = "Jumlah Jemaah Haji (Orang)", 
    y = "Frekuensi (Jumlah Provinsi)"
  ) + 
  theme_classic() + 
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold")
  )
## Warning: Removed 4 rows containing non-finite outside the scale range
## (`stat_bin()`).

ggplot(Data, aes(x = "", y = Haji)) +
  geom_boxplot(fill = "red", na.rm = TRUE) +
  labs(
    title = "Box Plot Jumlah Jemaah Haji Indonesia 2025", 
    x = "", 
    y = "Jumlah Jemaah Haji (Orang)"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold")
  )

Data_Kalimantan <- Data %>% filter(str_starts(Provinsi, "Kalimantan"))

ggplot(Data_Kalimantan, aes(x = Provinsi, y = Haji, fill = Provinsi)) +
  geom_col() +
  labs(
    title = "Jumlah Jemaah Haji Pulau Kalimantan Tahun 2025", 
    x = "Provinsi", 
    y = "Jumlah Jemaah Haji (Orang)"
  ) +
  theme_minimal() +
  theme(
    axis.text.x = element_text(angle = 45, hjust = 1),
    plot.title = element_text(hjust = 0.5, face = "bold"),
    legend.position = "none"
  )