Skip to content

Instantly share code, notes, and snippets.

@sanjayssane
Created August 21, 2017 08:50
Show Gist options
  • Select an option

  • Save sanjayssane/45db576f4b56467445295ce844a2634f to your computer and use it in GitHub Desktop.

Select an option

Save sanjayssane/45db576f4b56467445295ce844a2634f to your computer and use it in GitHub Desktop.
library(shiny)
# Define server logic required to draw a histogram
function(input, output) {
# Expression that generates a histogram. The expression is
# wrapped in a call to renderPlot to indicate that:
#
# 1) It is "reactive" and therefore should be automatically
# re-executed when inputs change
# 2) Its output type is a plot
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment