title: Shiny App Time Series plot with data table
body: <p>I am trying to build a simply Shiny app, which can take data input from a CSV file and then display the data along with a plot, here is the R code that I have written,</p>
  
  <pre><code>require(graphics) 
  shinyServer(function(input, output) {
  
  #This function is repsonsible for loading in the selected file
  filedata &lt;- reactive({
  infile &lt;- input$datafile
      if (is.null(infile)) {
  # User has not uploaded a file yet
        return(NULL)
        data &lt;- read.csv(inFile$datapath)
        data
      }
      read.csv(infile$datapath)
  
    })
  
  
    #This previews the CSV data file
    output$filetable &lt;- renderTable({
      filedata()
    })
  
    #Plot time Series plot
    output$tsplot &lt;- renderPlot({
      x &lt;- as.numeric(filedata)
      ts.obj &lt;- ts(x)
      lowess.obj &lt;- lowess(ts.obj, f = 10)
      plot.ts(x, main = "Sample Time Series", xlab = "Time")
      points(x)
      lines(lowess.obj$y, col = "red")
      legend("top", legend = "Loess Smoother", col = "red", lty = 1)
    })
  </code></pre>
  
  <p>but when I run this I get an error 'ERROR : cannot coerce type 'closure' to vector of type 'double'', not able to figure out what is wrong</p>