mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-06 04:35:13 -05:00
21 lines
566 B
R
21 lines
566 B
R
library(shiny)
|
|
|
|
# Define server logic required to generate and plot a random distribution
|
|
shinyServer(function(input, output) {
|
|
|
|
# Function that generates a plot of the distribution. The function
|
|
# is wrapped in a call to reactivePlot 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 <- reactivePlot(function() {
|
|
|
|
# generate an rnorm distribution and plot it
|
|
dist <- rnorm(input$obs)
|
|
hist(dist)
|
|
})
|
|
|
|
})
|