Nama: Nachsyas Arham Mumtaz Nashohi
NIM: 230605110041
Universitas: UIN Maulana Malik Ibrahim
Fakultas: SAINTEK
Program Studi: Teknik Informatika
library(shiny)
data(mtcars)

ui <- fluidPage(
  titlePanel("Aplikasi Shiny"),
  
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "variable",
                  label = "Select variable: ",
                  choices = names(mtcars),
                  selected = "mpg"),
      sliderInput(inputId = "bins",
                  label = "total of bins: ",
                  min = 10,
                  max = 60,
                  value = 30)
    ),
  
    mainPanel(
      plotOutput(outputId = "distPlot")
    )
  )
)
server <- function(input, output) {
  
  output$distPlot <- renderPlot({
    
    x    <- mtcars[[input$variable]]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    
    hist(x, breaks = bins, col = "#007bc2", border = "white", xlab = paste("Nilai", input$variable),
         main = paste("Histogram dari", input$variable))
    
  })
  
}
shinyApp(ui = ui, server = server)
Shiny applications not supported in static R Markdown documents