Skip to content

Instantly share code, notes, and snippets.

@piroyoung
Created January 13, 2014 13:00
Show Gist options
  • Save piroyoung/8399858 to your computer and use it in GitHub Desktop.
Save piroyoung/8399858 to your computer and use it in GitHub Desktop.
library(shiny)
# Define server logic required to generate and plot a random distribution
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
N.sample <- input$obs
N.mean <- 5000
br <- (1:100) /50 + 2.5
seq.mean <- numeric(length = N.mean)
for( i in 1:N.mean){
seq.mean[i] <- mean(ceiling(runif(N.sample, min = 0, max = 6)))
}
hist(seq.mean, breaks = br , xlim = c(2.5,4.5), ylim = c(0,N.mean/4))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment