Skip to content

Instantly share code, notes, and snippets.

@chan-ume
Created August 19, 2018 22:41
Show Gist options
  • Save chan-ume/d6b70b2b28e1f2227c385edc3e51f1df to your computer and use it in GitHub Desktop.
Save chan-ume/d6b70b2b28e1f2227c385edc3e51f1df to your computer and use it in GitHub Desktop.
shiny-exapmle
library(shiny)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
x <- iris[, input$numericInputData]
bins <- seq(min(x), max(x), length.out = input$sliderInputData + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
library(shiny)
shinyUI(fluidPage(
titlePanel("numericInput"),
sidebarLayout(
sidebarPanel(
numericInput("numericInputData",
"irisデータでヒストグラムを表示する列番号",
min = 1,
max = 4,
value = 1),
sliderInput("sliderInputData",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment