title: why is R referring to old .Rmd file
body: <p>I have a shinyapp that works and wanted to include an rmarkdown document that can be downloaded once you have interacted with my shinyapp. </p>
  
  <p>As I started building the .rmd file I have made changes and edits to it but it is still has the old version saved. I know this because I added text to the .rmd file that isn't showing up but if i change the name of the document to 1.rmd and reference that in my R code it generates the new document.</p>
  
  <p>ui</p>
  
  <pre><code>               radioButtons('format', 'Document format', c('PDF', 'HTML', 'Word'),
                          inline = TRUE),
             downloadButton('downloadReport', 'Download Report'),
  </code></pre>
  
  <p>server</p>
  
  <pre><code>output$downloadReport &lt;- downloadHandler(
  filename = function() {
  paste('report', sep = '.', switch(
    input$format, PDF = 'pdf', HTML = 'html', Word = 'docx'
  ))
  },
  
  content = function(file) {
  src &lt;- normalizePath('shinyAppTest1.Rmd')
  
  # temporarily switch to the temp dir, in case you do not have write
  # permission to the current working directory
  owd &lt;- setwd(tempdir())
  on.exit(setwd(owd))
  file.copy(src, 'shinyAppTest1.Rmd')
  
  out &lt;- rmarkdown::render('shinyAppTest1.Rmd', switch(
    input$format,
    PDF = pdf_document(fig_caption = TRUE, fig_width = 7, fig_height = 3.5),
    HTML = html_document(),
    Word = word_document()
  ))
  file.rename(out, file)
  }
  )
  </code></pre>
  
  <p>rmd.</p>
  
  <pre><code>---
  title: "Untitled"
  output: pdf_document
  ---
  
  This is an R Markdown document. Markdown is a simple formatting syntax for          authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see &lt;http://rmarkdown.rstudio.com&gt;.
  
  When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
  
  You can also embed plots, for example:
  
  TEST
  </code></pre>