title: R Shiny Error: "cannot find function "shinyServer"
body: <p>New to R shiny. Simulating the shiny server found on <a href="http://gist.github.com/wch/4034323.2" rel="nofollow">Github</a> but for a logistic distribution instead of the quadratic, linear and LOESS shown. In my code, the checkboxes are taken out and the y-variable is a categorical variable. R does not display errors  until the ending with }) in the console. R stated "could not find function "shinyServer". I did not try the app with runApp() because the error occurred.  </p>
  
  <p>My code:</p>
  
  <pre><code>library(ggplot2)
  
  hw &lt;- read.csv("LogitTV.csv")
  
  in_range &lt;- function(x, range) {
   x &gt;= min(range) &amp; x &lt;= max(range)
  
  }
  
  shinyServer(function(input, output) {
  
   limit_data_range &lt;- function() {
  
       if (is.null(input$x_range) || is.null(input$y_range)) {
           return(NULL)
       }
  
       hw_sub &lt;- hw[in_range(hw[[input$x_var]], input$x_range) &amp;
                   in_range(hw[[input$y_var]], input$y_range), ]
  
       hw_sub
   }
  
  
  
   output$main_plot &lt;- renderPlot({
  
  
       hw_sub &lt;- limit_data_range()
  
       if (is.null(hw_sub))
           return()
  
  
       xdat &lt;- hw[[input$x_var]]
           ydat &lt;- hw[[input$y_var]]
  
  
  
  
  
       if(input$mod_logistic)
           point_alpha &lt;- 0.5  
       else
           point_alpha &lt;- 1
  
  
  
  
  
  
       p &lt;- ggplot(hw_sub, mapping = aes_mapping) +
           points +
           theme_bw() +
           scale_colour_hue(l = 40) +
           scale_shape(solid = FALSE) +
  
           scale_x_continuous(limits = range(xdat)) +
           scale_y_continuous(limits = range(ydat))
  
  
  
  
       if (max(input$x_range) != max(xdat)) {
               p &lt;- p + geom_vline(xintercept = max(input$x_range), linetype = "dashed",
                                   alpha = 0.3)
           }
           if (min(input$x_range) != min(xdat)) {
           p &lt;- p + geom_vline(xintercept = min(input$x_range), linetype = "dashed",
                               alpha = 0.3)
       }
  
       if (max(input$y_range) != max(ydat)) {
               p &lt;- p + geom_hline(yintercept = max(input$y_range), linetype = "dashed",
                                   alpha = 0.3)
           }
           if (min(input$y_range) != min(ydat)) {
           p &lt;- p + geom_hline(yintercept = min(input$y_range), linetype = "dashed",
                               alpha = 0.3)
       }
  
  
       if (input$mod_logistic) {
           p &lt;- p + geom_smooth(method = lm, se = FALSE, size = 0.75,    
                               linetype = "dotdash")
           }
  
       print
   })
  
  
  
   output$x_range_slider &lt;- renderUI({
           xmin &lt;- floor(min(hw[[input$x_var]]))
           xmax &lt;- ceiling(max(hw[[input$x_var]]))
  
       sliderInput(inputId = "x_range",
                   label = paste("Limit range"),
                   min = xmin, max = xmax, value = c(xmin, xmax))
   })
  
   output$y_range_slider &lt;- renderUI({
           ymin &lt;- floor(min(hw[[input$y_var]]))
           ymax &lt;- ceiling(max(hw[[input$y_var]]))
  
       sliderInput(inputId = "y_range",
                   label = paste("Limit range"),
                   min = ymin, max = ymax, value = c(ymin, ymax))
   })
  
  
  
  
  
   make_model &lt;- function(model_type, formula, ...) {
  
       hw_sub &lt;- limit_data_range()
       if (is.null(hw_sub))
           return()
  
  
  
       do.call(model_type, args = list(formula = formula, data = quote(hw_sub), ...))
   }
  
   output$mod_logistic_text &lt;- renderPrint({
           formula &lt;- paste(input$y_var, "~", input$x_var)
  
   })
  </code></pre>
  
  <p>})
  Error: could not find function "shinyServer"</p>