Dashboard kinerja bank

dion notariodion notario
1 min read

Di waktu luang coba-coba membuat dashboard untuk mengevaluasi kinerja bank dengan bantuan AI generative. Hasilnya di luar ekspektasi, ternyata mantap.

Ini kode pemrograman R yang dibuat oleh AI.

library(shiny)
library(shinydashboard)
library(readxl)
library(dplyr)
library(ggplot2)

ui <- dashboardPage(
  dashboardHeader(title = "Dashboard Kinerja Bank"),
  dashboardSidebar(
    fileInput("file", "Upload File Excel", accept = c(".xlsx")),
    uiOutput("tahun_ui")
  ),
  dashboardBody(
    fluidRow(
      valueBoxOutput("roaBox"),
      valueBoxOutput("roeBox"),
      valueBoxOutput("carBox")
    ),
    fluidRow(
      box(plotOutput("nplPlot"), width = 6),
      box(plotOutput("nimPlot"), width = 6)
    )
  )
)

server <- function(input, output, session) {

  data_input <- reactive({
    req(input$file)
    read_excel(input$file$datapath)
  })

  output$tahun_ui <- renderUI({
    req(data_input())
    selectInput("tahun", "Pilih Tahun:", choices = unique(data_input()$Tahun))
  })

  data_filtered <- reactive({
    req(input$tahun)
    data_input() %>% filter(Tahun == input$tahun)
  })

  output$roaBox <- renderValueBox({
    valueBox(paste0(round(mean(data_filtered()$ROA, na.rm = TRUE), 2), "%"), 
             "ROA", icon = icon("chart-line"), color = "green")
  })

  output$roeBox <- renderValueBox({
    valueBox(paste0(round(mean(data_filtered()$ROE, na.rm = TRUE), 2), "%"), 
             "ROE", icon = icon("percentage"), color = "blue")
  })

  output$carBox <- renderValueBox({
    valueBox(paste0(round(mean(data_filtered()$CAR, na.rm = TRUE), 2), "%"), 
             "CAR", icon = icon("bank"), color = "purple")
  })

  output$nplPlot <- renderPlot({
    ggplot(data_filtered(), aes(x = Bulan, y = NPL)) +
      geom_line(color = "red") +
      labs(title = "NPL Bulanan", y = "%", x = "Bulan")
  })

  output$nimPlot <- renderPlot({
    ggplot(data_filtered(), aes(x = Bulan, y = NIM)) +
      geom_col(fill = "steelblue") +
      labs(title = "Net Interest Margin (NIM)", y = "%", x = "Bulan")
  })
}

shinyApp(ui, server)
0
Subscribe to my newsletter

Read articles from dion notario directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

dion notario
dion notario