title: shiny selecting specific columns from uploaded data frame
body: <p>I have merged different sources of code to make an app that allows one to upload a file (data frame).</p>
  
  <p>However, beyond this I would also like to make it possible to select specific columns from the data frame and analyse them. This is difficult however as one must predefine the given data frame in order to be able to refer to it in the ui.R script....
  So when a previously undefined data frame is uploaded to the site, one can not revere to it in the ui.R as it is defined in the server....</p>
  
  <p><strong>predefined variables</strong></p>
  
  <pre><code>vchoices &lt;- 1:ncol(mtcars)
  names(vchoices) &lt;- names(mtcars)
  </code></pre>
  
  <p>ui.R</p>
  
  <pre><code>    runApp(
        ui = basicPage(
          h2('The uploaded file data'),
          dataTableOutput('mytable'),
          fileInput('file', 'Choose info-file to upload',
                    accept = c(
                      'text/csv',
                      'text/comma-separated-values',
                      'text/tab-separated-values',
                      'text/plain',
                      '.csv',
                      '.tsv'
                    )
          ),
          actionButton("choice", "incorporate external information"),
  
          selectInput("columns", "Select Columns", choices=vchoices, inline = T),
          #notice that the 'choices' in selectInput are set to the predefined 
          #variables above whereas I would like to set them equal to the 
          #not yet defined uploaded file below in server.R
  
          tableOutput("table_display")
        ))
  </code></pre>
  
  <p>Notice that the 'choices' in selectInput are set to the predefined variables above whereas I would like to set them equal to the not yet defined uploaded file below in server.R</p>
  
  <p>server.R</p>
  
  <pre><code>  server = function(input, output) {
  
        info &lt;- eventReactive(input$choice, {
          inFile &lt;- input$file
          if (is.null(inFile))
            return(NULL)
          isolate(f&lt;-read.table(inFile$datapath, header = T,
                                 sep = "\t"))
          f
        })
        output$table_display&lt;-renderTable({
          f&lt;-info()
          f&lt;-subset(f, select=input$columns) #subsetting takes place here
          head(f)
        })
      }
  </code></pre>
  
  <p>Does anyone know of a way to refer to a variable that's defined in in the server, in the ui and thus allow for interactive manipulation?</p>