title: RShiny: How to pass variable from Server.R to an RMD script
body: <p>I am playing around with RShiny recently, and I've built a working web interface that takes two parameters "date" and "location" and gives me back a series of graphs and tables from our database that fit the criteria. </p>
  
  <p>What I would like to do with that, is to have users being able to download all the data and graphs in the form of a RMD report in HTML format. </p>
  
  <p>so I have 
  1. UI.R with a download button
  2. Server.R's downloadHandler starts my RMD script
  3. ???? </p>
  
  <p>UI.R </p>
  
  <pre><code>downloadButton('downloadData','Download')
  </code></pre>
  
  <p>Server.R</p>
  
  <pre><code>output$downloadData&lt;- downloadHandler(filename ="myData.html", 
                                    content= function(file= NULL){
                                      knit(thread.RMD) 
                                    }
  </code></pre>