install.packages(“esquisse”) install.packages(“ggplot2”) library(esquisse)
data_aps <- read.csv("C:/Users/user/Downloads/APS 2019-2024 Penduduk Usia 2019-2024.csv")
head(data_aps)
## Tahun Angka.Partisipasi.Sekolah..APS.
## 1 2019 71.92
## 2 2020 71.44
## 3 2021 70.74
## 4 2022 72.88
## 5 2023 73.07
## 6 2024 74.35
#esquisser(data_aps)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.2
ggplot(data_aps) +
aes(x = Tahun, y = Angka.Partisipasi.Sekolah..APS.) +
geom_line(linewidth = 2L, colour = "#0C4C8A") +
theme_minimal()
data_pembeli <- read.csv("C:/Users/user/Downloads/calonpembelimobil (2).csv")
head(data_pembeli)
## ID Usia Status Kelamin Memiliki_Mobil Penghasilan..Juta.Rupiah.per.Tahun.
## 1 1 32 1 0 0 240
## 2 2 49 2 1 1 100
## 3 3 52 1 0 2 250
## 4 4 26 2 1 1 130
## 5 5 45 3 0 2 237
## 6 6 39 2 0 1 280
## Beli_Mobil
## 1 1
## 2 0
## 3 1
## 4 0
## 5 1
## 6 1
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.2
##
## 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)
data_pembeli %>%
filter(Usia >= 24L & Usia <= 80L) %>%
ggplot() +
aes(x = Usia) +
geom_histogram(bins = 30L, fill = "#112446") +
labs(x = "Usia",
y = "Frekuensi", title = "Frekuensi Usia Calon Pembeli Mobil") +
theme_minimal()