Ini adalah analisis data BI Rate tahun 1 Januari 2020 sampai dengan 30 September 2024, analisis ini dibuat untuk membantu tim bisnis untuk menentukan mata uang mana yang volatilitasnya tinggi sehingga harus dihindari perdagangannya.
##
## 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
##
## 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
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
## [1] "JPY" "EUR" "AUD" "GBP" "HKD" "MYR" "THB" "USD"
## [1] 15152 6
## [1] "Mata_uang" "Nilai" "Kurs_Jual" "Kurs_Beli" "Kurs_tengah"
## [6] "Tanggal"
Berdasarkan hasil inspeksi data kita menemukan bahwa: - Data Rate berisi 15,152 baris dan 9 kolom - Nama-nama kolom adalah sebagai berikut: “Mata_uang”, “Nilai”, “Kurs_Jual”, “Kurs_Beli”, “Kurs_tengah”, “Tanggal”, “Month”, “Year”, “Month_Year”
Dalam proses ini kita akan melihat terlebih dahulu struktur dari data
## tibble [15,152 × 6] (S3: tbl_df/tbl/data.frame)
## $ Mata_uang : chr [1:15152] "JPY" "JPY" "JPY" "JPY" ...
## $ Nilai : num [1:15152] 100 100 100 100 100 100 100 100 100 100 ...
## $ Kurs_Jual : num [1:15152] 10620 10514 10540 10563 10632 ...
## $ Kurs_Beli : num [1:15152] 10512 10408 10434 10457 10525 ...
## $ Kurs_tengah: num [1:15152] 10566 10461 10487 10510 10578 ...
## $ Tanggal : chr [1:15152] "9/30/2024 12:00:00 AM" "9/27/2024 12:00:00 AM" "9/26/2024 12:00:00 AM" "9/25/2024 12:00:00 AM" ...
Berdasarkan struktur data kita bisa simpulkan bahwa kolom tanggal belum dalam format yang bisa dianalisa sehingga diperlukan modifikasi terhadap tipe datanya. Serta dibutukahkan penambahan kolom Month, Year dan Kombinasi Month_Year untuk keperluan analisa lebih lanjut.
rate <- rate %>%
mutate(
# Convert 'Tanggal' to datetime (with fallback if mdy_hms doesn't parse correctly)
Tanggal = suppressWarnings(mdy_hms(Tanggal)),
# Ensure the numeric columns are numeric
Kurs_Jual = as.numeric(Kurs_Jual),
Kurs_Beli = as.numeric(Kurs_Beli),
Kurs_tengah = as.numeric(Kurs_tengah),
Month = month(Tanggal, label = TRUE, abbr = TRUE), # Extract abbreviated month name
Year = year(Tanggal), # Extract year
Month_Year = paste(Month, Year) # Combine Month and Year into a single column
)## tibble [15,152 × 9] (S3: tbl_df/tbl/data.frame)
## $ Mata_uang : chr [1:15152] "JPY" "JPY" "JPY" "JPY" ...
## $ Nilai : num [1:15152] 100 100 100 100 100 100 100 100 100 100 ...
## $ Kurs_Jual : num [1:15152] 10620 10514 10540 10563 10632 ...
## $ Kurs_Beli : num [1:15152] 10512 10408 10434 10457 10525 ...
## $ Kurs_tengah: num [1:15152] 10566 10461 10487 10510 10578 ...
## $ Tanggal : POSIXct[1:15152], format: "2024-09-30" "2024-09-27" ...
## $ Month : Ord.factor w/ 12 levels "Jan"<"Feb"<"Mar"<..: 9 9 9 9 9 9 9 9 9 9 ...
## $ Year : num [1:15152] 2024 2024 2024 2024 2024 ...
## $ Month_Year : chr [1:15152] "Sep 2024" "Sep 2024" "Sep 2024" "Sep 2024" ...
Kesimpulan dari hasil manipulasi/modifikasi data adalah perubahan tipe data tanggal dari chr ke POSIXct (penanggalan standar international) serta penambahan kolom Month, Year dan Month_Year untuk memudahkan proses analisa lebih lanjut.
# Create a new rate frame to subset the rate by Mata_uang and Month_Year
average_kurs_tengah <- rate %>%
group_by(Mata_uang, Month_Year) %>%
summarise(Average_Kurs_tengah = mean(Kurs_tengah, na.rm = TRUE)) %>%
ungroup()## `summarise()` has grouped output by 'Mata_uang'. You can override using the
## `.groups` argument.
# Create a new column for the average computation of Kurs_tengah
# Create the line chart
ggplot(average_kurs_tengah, aes(y = Average_Kurs_tengah, group = Mata_uang, color = Mata_uang)) +
geom_boxplot(aes(fill = Mata_uang)) +
labs(title = "Distribution of Kurs_tengah by Mata_uang and Month_Year", x = "Month_Year", y = "Average Kurs_tengah") +
theme_minimal() +
theme(axis.text.x = element_blank())Kesimpulan: Berdasarkan chart boxplot ini, ditemukan ada dua mata uang yang memiliki nilai anomali yaitu MYR dan THB, apabila dimungkinkan, untuk sementara tim bisnis diharapkan untuk menghindari dua mata uang tersebut untuk diperdagangkan.