data <- read.table(file.choose(), header = TRUE)
data
## Provinsi Persentase_Lansia
## 1 ACEH 9.56
## 2 SUMATERA_UTARA 10.25
## 3 SUMATERA_BARAT 12.01
## 4 RIAU 8.65
## 5 JAMBI 9.96
## 6 SUMATERA_SELATAN 10.65
## 7 BENGKULU 10.25
## 8 LAMPUNG 11.39
## 9 KEP_BANGKA_BELITUNG 10.26
## 10 KEP_RIAU 8.07
## 11 DKI_JAKARTA 12.01
## 12 JAWA_BARAT 11.51
## 13 JAWA_TENGAH 14.43
## 14 DI_YOGYAKARTA 17.83
## 15 JAWA_TIMUR 15.45
## 16 BANTEN 9.51
## 17 BALI 15.07
## 18 NUSA_TENGGARA_BARAT 9.72
## 19 NUSA_TENGGARA_TIMUR 9.94
## 20 KALIMANTAN_BARAT 9.88
## 21 KALIMANTAN_TENGAH 9.22
## 22 KALIMANTAN_SELATAN 10.26
## 23 KALIMANTAN_TIMUR 9.05
## 24 KALIMANTAN_UTARA 8.77
## 25 SULAWESI_UTARA 14.12
## 26 SULAWESI_TENGAH 9.93
## 27 SULAWESI_SELATAN 11.71
## 28 SULAWESI_TENGGARA 8.86
## 29 GORONTALO 10.48
## 30 SULAWESI_BARAT 8.81
## 31 MALUKU 9.57
## 32 MALUKU_UTARA 8.58
## 33 PAPUA_BARAT 6.77
## 34 PAPUA_BARAT_DAYA 7.84
## 35 PAPUA 7.98
## 36 PAPUA_SELATAN 6.81
## 37 PAPUA_TENGAH 6.71
## 38 PAPUA_PEGUNUNGAN 8.65
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.1 ✔ stringr 1.5.2
## ✔ lubridate 1.9.4 ✔ tibble 3.3.0
## ✔ purrr 1.1.0 ✔ tidyr 1.3.1
## ── 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
library(dplyr)
ggplot(data, aes(x = Persentase_Lansia)) +
geom_histogram(
binwidth = 2,
boundary = 0,
fill = "blue",
color = "black"
) +
scale_x_continuous(
breaks = seq(6, 18, by = 2),
limits = c(6, 18)
) +
labs(
title = "Persentase Penduduk Berumur 60 Tahun ke Atas",
x = "Persentase (%)",
y = "Frekuensi"
) +
theme_classic()

ggplot(data, aes(x="", y=Persentase_Lansia)) +
geom_boxplot(fill="red", color="black") +
labs(title = "Box Plot Persentase Penduduk Berumur 60 Tahun ke Atas, 2025", x="", y="Persentase (%)")+
theme_minimal()+
theme(plot.title = element_text(hjust = 0.5, face ="bold"))

Data_Kalimantan <- data %>%
filter(str_starts(Provinsi, "KALIMANTAN"))
Data_Kalimantan
## Provinsi Persentase_Lansia
## 1 KALIMANTAN_BARAT 9.88
## 2 KALIMANTAN_TENGAH 9.22
## 3 KALIMANTAN_SELATAN 10.26
## 4 KALIMANTAN_TIMUR 9.05
## 5 KALIMANTAN_UTARA 8.77
ggplot(Data_Kalimantan, aes(x = Provinsi,
y = Persentase_Lansia,
fill = Provinsi)) +
geom_col() +
labs(
title = "Persentase Penduduk Berumur 60 Tahun ke Atas di Pulau Kalimantan Tahun 2025",
x = "Provinsi",
y = "Persentase (%)"
) +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
plot.title = element_text(hjust = 0.5, face = "bold"),
legend.position = "none"
)
