title: dealing with an input dataset in R Shiny
body: <p>I'm new to R-Shiny and my question might be very simple. After hours of thinking and searching, I couldn't solve the issue. Here is the problem:</p>
  
  <p>1) My app asks user to upload his dataset. </p>
  
  <p>2) Then in the server file, I read the dataset and I did some analyses and I report back the results into the user interface. </p>
  
  <p>3)My user interface has 4 different out puts. </p>
  
  <p><strong>4) I read the dataset in the "render" function of each output.</strong> ISSUE: by doing so, the data is locally defined in the scope of each function which means that I need to read it over again for each output.</p>
  
  <p>5) This is very in-efficient, Is there any alternative? using reactive ?</p>
  
  <p>6) Below is a sample code showing how I wrote my server.R:</p>
  
  <pre><code>shinyServer(function(input, output) {
  
     # Interactive UI's:
     # %Completion
  
     output$myPlot1 &lt;- renderPlot({
       inFile &lt;- input$file
  
        if (is.null(inFile)) return(NULL)
        data &lt;- read.csv(inFile$datapath, header = TRUE)
  
        # I use the data and generate a plot here
  
     })
  
     output$myPlot2 &lt;- renderPlot({
       inFile &lt;- input$file
  
        if (is.null(inFile)) return(NULL)
        data &lt;- read.csv(inFile$datapath, header = TRUE)
  
        # I use the data and generate a plot here
  
     })
  
   })
  </code></pre>
  
  <p>How can I just get the input data once and just use the data in my output functions ?</p>
  
  <p>Thanks very much,</p>