title: selectInput based on columns of uploading csv file
body: <p>I am trying to build a shiny app where I can upload a csv file and based on the column names, from <code>selectInput</code> - app shows basic statistic (graphs, descriptive statistic-average, sd, var .... and some statistical tests). 
  <strong>There is no problem with datasets, which are already in the app. Also no problem with statistics.</strong>
  Problem is how to make working <code>selectInput</code> with the names of columns from new upload csv file.</p>
  
  <p>Here is my light version of code:</p>
  
  <p>UI: </p>
  
  <pre><code>library(shiny)
  shinyUI(fluidPage(
      titlePanel("xxx"),
  
      sidebarLayout(
          sidebarPanel(
              fileInput("csvFile", "Drag cars.csv over here!"),
              selectInput("var", "choose variable:", choices= names(data()))
          ),
  
          mainPanel(
              textOutput("average"),
              plotOutput("plot")
          )
      )
  ))
  </code></pre>
  
  <p>SERVER:</p>
  
  <pre class="lang-r prettyprint-override"><code>shinyServer(function(input, output, session) {
      data &lt;- reactive({
          file1 &lt;- input$csvFile
          if (is.null(file1)) { 
              return() 
          } 
          data = read.csv(file=file1$datapath)
          data
      })
      output$average &lt;- renderText({
          paste("average is: ", mean(data()[,input$var]))
      })
      output$plot &lt;- renderPlot({
          boxplot(data()[,input$var])
      })
  })
  </code></pre>