3

I want to get a window when I want to download a plot to pdf, where I can choose the location of the downloaded plot. Here is my code on the server side:

output$export = downloadHandler(
     filename = function() {"plots.pdf"},
     content = function(file) {
       ggsave(file="Analyse.pdf", width=11, height=8.5)

     }

Now it instantly downloads the file to my working directory but I would like to have a window where I can choose the download location. Maybe it is a silly question but I did not have any success yet by finding a solution on the web.

I hope you guys can help me out!

Tomcatn00b
  • 65
  • 7

1 Answers1

2

I have found the answer by playing around with the code by myself. It was indeed something silly.

output$export = downloadHandler(
     filename = function() {"plots.pdf"},
     content = function(file) {
       ggsave(**file**, device = "pdf", width=11, height=8.5)

     }
   )

I just had to change the file name to "file". Now it will let me download it to a place of choice. I also added the device so it will be saved as a PDF.

Thanks anyways!

Tomcatn00b
  • 65
  • 7
  • That's essentially what I have when I came searching for the answer to this question. Mine does not let me choose where. It goes straight to downloads. Any thoughts? – Scott Hunter May 11 '18 at 18:04