Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rearranged directories to put the base app in revision control.

  • Loading branch information...
commit 5168b027ddbb85eaacbe7027fa716a0e01a2df95 1 parent 05ca507
@trestletech authored
View
0  server.R → myapp/server.R
File renamed without changes
View
0  ui.R → myapp/ui.R
File renamed without changes
View
22 sampleapp/server.R
@@ -0,0 +1,22 @@
+shinyServer(function(input, output) {
+
+ output$main_plot <- reactivePlot(function() {
+
+ hist(faithful$eruptions,
+ probability = TRUE,
+ breaks = as.numeric(input$n_breaks),
+ xlab = "Duration (minutes)",
+ main = "Geyser eruption duration")
+
+ if (input$individual_obs) {
+ rug(faithful$eruptions)
+ }
+
+ if (input$density) {
+ dens <- density(faithful$eruptions,
+ adjust = input$bw_adjust)
+ lines(dens, col = "blue")
+ }
+
+ })
+})
View
25 sampleapp/ui.R
@@ -0,0 +1,25 @@
+shinyUI(bootstrapPage(
+
+ selectInput(inputId = "n_breaks",
+ label = "Number of bins in histogram (approximate):",
+ choices = c(10, 20, 35, 50),
+ selected = 20),
+
+ checkboxInput(inputId = "individual_obs",
+ label = strong("Show individual observations"),
+ value = FALSE),
+
+ checkboxInput(inputId = "density",
+ label = strong("Show density estimate"),
+ value = FALSE),
+
+ plotOutput(outputId = "main_plot", height = "300px"),
+
+ # Display this only if the density is shown
+ conditionalPanel(condition = "input.density == true",
+ sliderInput(inputId = "bw_adjust",
+ label = "Bandwidth adjustment:",
+ min = 0.2, max = 2, value = 1, step = 0.2)
+ )
+
+))
Please sign in to comment.
Something went wrong with that request. Please try again.