Data yang digunakan adalah data rumah tangga tahun 2023 dari susenas. lebih spesifiknya kita akan menggunakan data pada blok VII.
library("tidyverse")
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── 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("ggridges")
library("GGally")
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
library("plotly")
##
## 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
data <- read_csv("/Users/fauzanfajari/Downloads/2023 Maret JABAR - SUSENAS KOR INDIVIDU PART1.csv")
## New names:
## • `` -> `...1`
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
## dat <- vroom(...)
## problems(dat)
## Rows: 84688 Columns: 183
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (70): R703_A, R703_B, R703_C, R703_D, R703_X, R807_A, R807_B, R807_C, R...
## dbl (100): ...1, URUT, PSU, SSU, WI1, WI2, R101, R102, R105, R401, R403, R40...
## lgl (13): R810_F, R811_F, R1107_F, R1109_D, R1110_A, R1110_C, R1110_F, R120...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(data)
## # A tibble: 6 × 183
## ...1 URUT PSU SSU WI1 WI2 R101 R102 R105 R401 R403 R404
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 500001 12448 123442 12435 123427 32 7 2 1 1 4
## 2 1 500001 12448 123442 12435 123427 32 7 2 2 3 2
## 3 2 500001 12448 123442 12435 123427 32 7 2 3 6 1
## 4 3 500001 12448 123442 12435 123427 32 7 2 4 6 1
## 5 4 500002 31373 311039 31360 311024 32 72 1 1 1 3
## 6 5 500002 31373 311039 31360 311024 32 72 1 2 3 1
## # ℹ 171 more variables: R405 <dbl>, R407 <dbl>, R408 <dbl>, R409 <dbl>,
## # R406A <dbl>, R406B <dbl>, R406C <dbl>, R410 <dbl>, R501 <dbl>, R502 <dbl>,
## # R503 <dbl>, R504 <dbl>, R506 <dbl>, R507 <dbl>, R508 <dbl>, R509 <dbl>,
## # R601 <dbl>, R602 <dbl>, R603 <dbl>, R604 <dbl>, R605 <dbl>, R606 <dbl>,
## # R607 <dbl>, R608 <dbl>, R609 <dbl>, R610 <dbl>, R611 <dbl>, R612 <dbl>,
## # R613 <dbl>, R614 <dbl>, R615 <dbl>, R616 <dbl>, R617 <dbl>, R618 <dbl>,
## # R619 <dbl>, R620 <dbl>, R621 <dbl>, R701 <dbl>, R702 <dbl>, R703_A <chr>, …
data %>% mutate(R703_A = ifelse(is.na(R703_A), "Tidak Bekerja", "Bekerja")) %>%
ggplot(aes(y = R703_A))+
geom_bar(fill = "lightblue") +
labs(title = "Perbandingan Penduduk Bekerja atau Tidak Bekerja", x = "Jumlah", y = "Bekerja atau Tidak") +
theme_classic() +
coord_flip()
Berdasarkan diagram batang yang terbentuk, terlihat bahwa jumlah Anggota Rumah Tangga (ART) yang tidak bekerja lebih banyak dari ART yang bekerja.
data %>% filter (R706 > 0) %>% mutate(R706 = case_when(
R706 == 1 ~ "Pertanian",
R706 == 2 ~ "Holtikultura",
R706 == 3 ~ "Perkebunan",
R706 == 4 ~ "Perikanan",
R706 == 5 ~ "Peternakan",
R706 == 6 ~ "Kehutanan",
R706 == 7 ~ "Pertambangan",
R706 == 8 ~ "Industri Pengolahan",
R706 == 9 ~ "Pengadaan Air dan Listrik",
R706 == 10 ~ "Pengelolaan",
R706 == 11 ~ "Konstruksi",
R706 == 12 ~ "Perdagangan",
R706 == 13 ~ "Pengangkutan",
R706 == 14 ~ "Penyedia Akomodasi",
R706 == 15 ~ "Informasi Komunikasi",
R706 == 16 ~ "Keuangan dan Asuransi",
R706 == 17 ~ "Real Estate",
R706 == 18 ~ "Aktivitas Profesional",
R706 == 19 ~ "Penyewaan",
R706 == 20 ~ "Adm. Pemerintahan",
R706 == 21 ~ "Pendidikan",
R706 == 22 ~ "Kesehatan dan Sosial",
R706 == 23 ~ "Kesenian dan Hiburan",
R706 == 24 ~ "Jasa Lainnya",
R706 == 25 ~ "Aktivitas Rumah Tangga",
R706 == 26 ~ "Badan Nasional-Internasional",
))%>%
count(R706) %>%
arrange(desc(n)) %>% # gunakan arrange(n) untuk mengurutkan sebaliknya
ggplot() +
geom_segment(aes(x = fct_reorder(as.factor(R706), n), xend = fct_reorder(as.factor(R706), n), y = 0, yend = n), color = "red") +
geom_point(aes(x = fct_reorder(as.factor(R706), n), y = n), color = "black", size = 2) +
scale_y_continuous(expand = c(0, 0)) +
coord_flip() +
ggtitle("Jenis Pekerjaan") +
xlab("") +
ylab("Jumlah Orang") +
theme_light() +
theme(plot.title = element_text(hjust = 0.5))
Adapun jenis pekerjaan dari ART yang bekerja didominasi pada sektor perdagangan. Meskipun sangat sedikit, tetapi masih ada ART yang bekerja di Badan Nasional dan Internasional
data %>% filter(R709!=0) %>%
ggplot()+
geom_histogram(aes(x=R709),fill="#69b3a2", color="#e9ecef", alpha=0.5)+
labs(title="Histogram Sebaran Lama Waktu Seluruh Pekerjaan")+
xlab("Lama Jam Kerja")+
ylab("Jumlah")+
xlim(0,100)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing missing values (`geom_bar()`).
Lama Jam kerja dari seluruh pekerjaan yang dilakukan oleh ART tidak terlihat menjulur kekiri maupun kekanan. Melainkan lebih ke arah menyebar normal.
data %>%
ggplot()+
geom_density(aes(x=R708,fill= "Lama Waktu Pekerjaan Utama" ),color="#e9ecef", alpha=0.4)+
geom_density(aes(x=R709,fill= "Lama Waktu Seluruh Pekerjaan" ),color="lightblue", alpha=0.4)+
labs(title="Density Plot Lama Waktu Pekerjaan Utama")+
xlab("Lama Jam Kerja")+
ylab("Jumlah")+
xlim(2,100)
## Warning: Removed 46501 rows containing non-finite values (`stat_density()`).
## Warning: Removed 46485 rows containing non-finite values (`stat_density()`).
Kita bisa melihat bagaimana perbandingan dari lama waktu pekerjaan utama dan lama waktu seluruh pekerjaan. lama waktu seluruh pekerjaan terlihat hanya sedikit lebih besar dari lama waktu pekerjaan utama.
kpk <- data.frame(
ket = c("Sendiri", "Dibantu", "Buruh Tidak Tetap", "Karyawan", "Pekerja Bebas", "Pekerja Keluarga"),
count = table(cut(data$R707, breaks=c(0,1,2,3,4,5,Inf), labels=c("1", "2", "3", "4", "5", "6")))
)
ggplot(kpk, aes(x = "", y = count.Freq , fill = ket)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0) +
scale_fill_brewer(palette = "Set3") +
theme_void() +
theme(legend.position = "right") +
labs(title = "Komposisi Posisi dalam Pekerjaan", fill = "Posisi dalam Pekerjaan") +
geom_text(aes(label = count.Freq), position = position_stack(vjust = 0.5))
Sebanyak 36% dari posisi pekerjaan dari ART adalah karyawan, sebanyak 9% adalah Dibantu dalam pekerjaan, 3% sebagai buruh tidak tetap, 20% bekerja sendiri, 5% pekerja keluarga yang tidak dibayar, 11% pekerja lepas atau pekerja bebas. Adapun visualisasinya dalam bentuk diagram donat adalah sebagai berikut;
kpk <- data.frame(
ket = c("Sendiri", "Dibantu", "Buruh Tidak Tetap", "Karyawan", "Pekerja Bebas", "Pekerja Keluarga"),
count = table(cut(data$R707, breaks=c(0,1,2,3,4,5,Inf), labels=c("1", "2", "3", "4", "5", "6")))
)
kpk$fraction = kpk$count.Freq / sum(kpk$count.Freq)
kpk$ymax = cumsum(kpk$fraction)
kpk$ymin = c(0, head(kpk$ymax, n=-1))
ggplot(kpk, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=ket)) +
geom_rect() +
coord_polar(theta="y") +
xlim(c(2, 4)) +
theme_classic()