How do I get the name of the R Shiny downloadHandler executable?

I am setting up a Shiny app that allows a user to upload a custom dataset. Following the tutorial , I installed the downloadHandler after the example provided in the docs (reproduced here as the same happens if I copy and paste this).

ui <- fluidPage(
  downloadLink("downloadData", "Download")
)

server <- function(input, output) {
  # Our dataset
  data <- mtcars

  output$downloadData <- downloadHandler(
    filename = function() {
      paste("data-", Sys.Date(), ".csv", sep="")
    },
    content = function(file) {
      write.csv(data, file)
    }
  )
}

shinyApp(ui, server)

      

Problem:

This issue only occurs on my Linux * system and seems to work fine on Mac. Loading and everything works fine, but the "Save" GUI doesn't give me the correct filename. There is no error or warning message. Based on my input,

  • I expect it to give me data-TIME.csv i.e. input to filename

    . (It doesn't work if I give it a simple string in that slot).

  • but it offers me DownloadData or whatever name I pass to the variable output

    (cf. screenshot).

enter image description here

Question:

  • Is this an OS issue as I suspect, or am I doing something wrong?

  • How can I fix this? Can I get this to work on any system?

Thank!

I am running elementary OS 0.4 Loki built on "Ubuntu 16.04.2 LTS", GTK version: 3.18.9. and RStudio 1.0.143

+3


source to share


1 answer


If you are using Rstudio Browser to test your application, this could be a problem. I have the same problem on Windows.



When I use Rstudio Browser the filename is not passed correctly, but if I use Firefox everything works fine . Your code also works fine in my Firefox.

+4


source







All Articles