Pivot adalah sebuah proses untuk menampilkan dan mengganalisa data secara singkat dan ringkas dalam jumlah yang besar dalam bentuk dan orientasi yang berbeda serta mampu melakukan kalkulasi pada setiap item yang dibutuhkan dengan menggunakan cara perhitungan sesuai kebutuhan dengan waktu yang singkat.
library(readxl)
## Warning: package 'readxl' was built under R version 4.1.2
pivotoutflowKalimantan <- read_excel(path = "D:/Matkul Sem2/Linear Algebra/pivot outflow Kalimantan.xlsx")
pivotoutflowKalimantan
## # A tibble: 5 x 12
## Provinsi `2011` `2012` `2013` `2014` `2015` `2016` `2017` `2018` `2019` `2020`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Kaliman~ 5221. 5698. 6011. 6764. 8486. 9402. 11132. 12278. 13768. 13501.
## 2 Kaliman~ 6850. 7741. 15421. 8346. 10190. 10131. 11695. 13040. 12891. 12518.
## 3 Kaliman~ 5126. 5580. 5046. 6265. 6755. 7424. 9544. 8476. 9228. 8222.
## 4 Kaliman~ 12337. 14426. 18451. 17398. 16514. 15221. 16525. 17724. 18596. 14993.
## 5 Kaliman~ 0 0 0 0 0 0 1507. 2471. 3096. 2826.
## # ... with 1 more variable: 2021 <dbl>
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.2
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## Warning: package 'tidyr' was built under R version 4.1.2
## Warning: package 'readr' was built under R version 4.1.2
## Warning: package 'purrr' was built under R version 4.1.2
## Warning: package 'dplyr' was built under R version 4.1.2
## Warning: package 'forcats' was built under R version 4.1.2
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
datalongerKalimantan2 <- pivotoutflowKalimantan %>%
pivot_longer(!Provinsi, names_to = "Tahun", values_to = "Kasus")
datalongerKalimantan2
## # A tibble: 55 x 3
## Provinsi Tahun Kasus
## <chr> <chr> <dbl>
## 1 Kalimantan Barat 2011 5221.
## 2 Kalimantan Barat 2012 5698.
## 3 Kalimantan Barat 2013 6011.
## 4 Kalimantan Barat 2014 6764.
## 5 Kalimantan Barat 2015 8486.
## 6 Kalimantan Barat 2016 9402.
## 7 Kalimantan Barat 2017 11132.
## 8 Kalimantan Barat 2018 12278.
## 9 Kalimantan Barat 2019 13768.
## 10 Kalimantan Barat 2020 13501.
## # ... with 45 more rows
library(dplyr)
Kalimantan12 <- select(datalongerKalimantan2, Provinsi, Kasus)
Kalimantan12
## # A tibble: 55 x 2
## Provinsi Kasus
## <chr> <dbl>
## 1 Kalimantan Barat 5221.
## 2 Kalimantan Barat 5698.
## 3 Kalimantan Barat 6011.
## 4 Kalimantan Barat 6764.
## 5 Kalimantan Barat 8486.
## 6 Kalimantan Barat 9402.
## 7 Kalimantan Barat 11132.
## 8 Kalimantan Barat 12278.
## 9 Kalimantan Barat 13768.
## 10 Kalimantan Barat 13501.
## # ... with 45 more rows
library(dplyr)
Kalimantan13 <- datalongerKalimantan2 %>%
filter(Provinsi == 'Kalimantan Timur') %>%
select('Provinsi', 'Tahun', 'Kasus')
Kalimantan13
## # A tibble: 11 x 3
## Provinsi Tahun Kasus
## <chr> <chr> <dbl>
## 1 Kalimantan Timur 2011 12337.
## 2 Kalimantan Timur 2012 14426.
## 3 Kalimantan Timur 2013 18451.
## 4 Kalimantan Timur 2014 17398.
## 5 Kalimantan Timur 2015 16514.
## 6 Kalimantan Timur 2016 15221.
## 7 Kalimantan Timur 2017 16525.
## 8 Kalimantan Timur 2018 17724.
## 9 Kalimantan Timur 2019 18596.
## 10 Kalimantan Timur 2020 14993.
## 11 Kalimantan Timur 2021 9110.
Kalimantan14 <- datalongerKalimantan2 %>%
filter(Provinsi == 'Kalimantan Timur', Tahun == '2021') %>%
select('Provinsi', 'Tahun', 'Kasus')
Kalimantan14
## # A tibble: 1 x 3
## Provinsi Tahun Kasus
## <chr> <chr> <dbl>
## 1 Kalimantan Timur 2021 9110.
ggplot(data = datalongerKalimantan2, mapping = aes(x = Tahun, y = Kasus)) +
geom_point() +
facet_wrap( ~ Provinsi) +
theme(axis.text.x = element_text(angle = 90))
ggplot(data = datalongerKalimantan2, mapping = aes(x = Provinsi, y = Kasus)) +
geom_point() +
facet_wrap( ~ Tahun) +
theme(axis.text.x = element_text(angle = 90))
1.https://en.wikipedia.org/wiki/Pivot_table#:~:text=Pivot%20tables%20are%20a%20technique%20in%20data%20processing.,to%20helping%20businesses%20or%20individuals%20make%20educated%20decisions.
2.https://www.kitalulus.com/seputar-kerja/pivot-table-adalah
3.https://www.bi.go.id/id/statistik/ekonomi-keuangan/ssp/indikator-pengedaran-uang.aspx