title: R Shiny: Error in serverFuncSource() : server.R returned an object of unexpected type: list
body: <p>I am trying to build my first shiny app and have borrowed heavily from available templates. Unfortunately when I run the application, it flashes up briefly before crashing. The associated error message is: </p>
  
  <blockquote>
    <p>Error in serverFuncSource() : server.R returned an object of
    unexpected type: list</p>
  </blockquote>
  
  <p>What is causing this error and how can I fix it (have had no luck with searches online). The error message is frustratingly vague.</p>
  
  <pre><code>require(shiny)
  
  ui = pageWithSidebar(
    headerPanel("NFL"),
      sidebarPanel(
        sliderInput("Margin", "Current margin", min=-50, max=50, value=0, step=1),
        textInput("Spread", "Spread", value=0, width="30%"),
        radioButtons("Quarter", "Current period", choices=c("1st", "2nd", "3rd", "4th", "OT"), 
                           selected = "1st", inline = TRUE,width = NULL),
        textInput("TimeRemaining", "Time remaining (mm:ss)", value="15:00",  width="30%"),
        radioButtons("Down", "Down", choices=c("1st", "2nd", "3rd", "4th", "N/A"), inline = TRUE),
        textInput("YTG", "Yards to go", value=10,  width="30%"),
        textInput("YFOG", "Yards from own goal", value=50,  width="30%"),
        checkboxGroupInput("Timeouts_Off", "Timeouts: Offense", choices=c("1", "2", "3")),
        checkboxGroupInput("Timeouts_Def", "Timeouts: Defence", choices=c("1", "2", "3"))
        ),
      mainPanel(
        tableOutput('table')
      )
    )
  
  server=function(input, output){
    x=matrix(0, nrow=1, ncol=11)
    colnames(x)=c("mar", "timeRemaining", "dwn.1", "dwn.2", "dwn.3", "dwn.4", "ytg","yfog", "closingLine", "timo", "timd")
  
    qtr=switch(input$Quarter, "1st"=1, "2nd"=2,"3rd"=3,"4th"=4, "OT"=5)
    mins=substr(input$TimeRemaining,1,2)
    secs=substr(input$TimeRemaining,4,5)
    timeLeft=100-10/6*((4-qtr)*15+(mins+secs/60))
  
    x[1,1]=input$Margin
    x[1,2]=timeLeft
    x[1,3]=switch(input$Down, "1st"=1, "2nd"=0,"3rd"=0,"4th"=0)
    x[1,4]=switch(input$Down, "1st"=0, "2nd"=1,"3rd"=0,"4th"=0)
    x[1,5]=switch(input$Down, "1st"=0, "2nd"=0,"3rd"=1,"4th"=0)
    x[1,6]=switch(input$Down, "1st"=0, "2nd"=0,"3rd"=0,"4th"=1)
    x[1,7]=input$YTG
    x[1,8]=input$YFOG
    x[1,9]=input$spread
    x[1,10]=input$Timeouts_Off
    x[1,11]=input$Timeouts_Def
  
    #x=data.frame(x)
    xsq=select(x,mar:timd, -dwn.1, -dwn.2, -dwn.3, -dwn.4)^2
    colnames(xsq)=paste(colnames(xsq), "sq",  sep = "_")
    xln=log(select(x,timeRemaining:timd, -closingLine, -dwn.1, -dwn.2, -dwn.3, -dwn.4))
    colnames(xln)=paste(colnames(xln), "ln",  sep = "_")
    x=cbind(x, xsq, xln)
    rm(xln, xsq)
    x
    output$table &lt;- renderTable(x)
  }
  
  shinyApp(ui=ui, server=server)
  </code></pre>