library(shiny)
# UI 정의
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(
sliderInput("bins", "Number of bins:",
min = 1, max = 50, value = 30)
),
mainPanel(plotOutput("distPlot"))
)
)
# Server 로직 정의
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# 앱 실행
shinyApp(ui = ui, server = server)