title: rmarkdown normalizePath error in download
body: <p>I got the following code from <a href="https://github.com/rstudio/shiny-examples/tree/master/016-knitr-pdf" rel="nofollow noreferrer">https://github.com/rstudio/shiny-examples/tree/master/016-knitr-pdf</a> however cannot get it to run on my computer. The PDF, html, and word all result in the same error - in my download window in my browser it simply says "Failed - Server problem," In my r console it gives me the following details:</p>
  
  <pre><code>Warning in normalizePath(path.expand(path), winslash, mustWork) :
   path[1]="report.Rmd": The system cannot find the file specified
  Warning in normalizePath(path.expand(path), winslash, mustWork) :
   path[1]="report.Rmd": The system cannot find the file specified
  Warning: Error in tools::file_path_as_absolute: file 'report.Rmd' does not 
  exist
   [No stack trace available]
  </code></pre>
  
  <p>Any ideas how to fix this error?? I've never worked with rmarkdown, any advice is greatly appreciated!!</p>
  
  <p>UI:</p>
  
  <pre><code>library(shiny)
  
  ui &lt;- fluidPage(
     title = 'Download a PDF report',
     sidebarLayout(
     sidebarPanel(
     helpText(),
    selectInput('x', 'Build a regression model of mpg against:',
                choices = names(mtcars)[-1]),
    radioButtons('format', 'Document format', c('PDF', 'HTML', 'Word'),
                 inline = TRUE),
    downloadButton('downloadReport')
  ),
     mainPanel(
       plotOutput('regPlot')
     )
   )
  </code></pre>
  
  <p>)</p>
  
  <p>Server:</p>
  
  <pre><code> server &lt;- function(input, output) {
  
   regFormula &lt;- reactive({
     as.formula(paste('mpg ~', input$x))
   })
  
   output$regPlot &lt;- renderPlot({
     par(mar = c(4, 4, .1, .1))
     plot(regFormula(), data = mtcars, pch = 19)
   })
  
   output$downloadReport &lt;- downloadHandler(
     filename = function() {
       paste('my-report', sep = '.', switch(
         input$format, PDF = 'pdf', HTML = 'html', Word = 'docx'
       ))
     },
  
     content = function(file) {
       src &lt;- normalizePath('report.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, 'report.Rmd', overwrite = TRUE)
  
       library(rmarkdown)
       out &lt;- render('report.Rmd', switch(
         input$format,
         PDF = pdf_document(), HTML = html_document(), Word = word_document()
       ))
       file.rename(out, file)
     }
     )
  
    }
  
    shinyApp(ui = ui, server = server)
  </code></pre>