Shiny app: downloadHandler does not produce a file

前端 未结 3 1896
说谎
说谎 2020-12-01 14:45

I can\'t figure out what\'s going on - everything seems to work but my app does not generate a file - although it looks like it does. I run it in Windows, on RStudio 0.98.12

相关标签:
3条回答
  • 2020-12-01 15:00

    Adding to what Colin D said. It can just be that your idNAME is too long.

    I just tested on my app that THIS WORKS:

         output$download_mastergroup <- downloadHandler(...)   #server side
         downloadButton('download_mastergroup ', 'Download overview') #ui side
    

    and that THIS DOES NOT WORK:

         output$download_mastergroup_overview <- downloadHandler(...)   #server side
         downloadButton('download_mastergroup_overview ', 'Download overview') #ui side
    

    So, be concise and it will be allright!

    0 讨论(0)
  • 2020-12-01 15:10

    The example provided works fine for downloading CSV in my tests (if it is from the webbrowser that is, using Run app within RStudio did cause same issue)

    Note that if you keep getting something like "download.html" from your download button instead of the downloaded content, you must make sure the ID from downloadButton("myIdHere", ...) matches output$myIdHere = downloadHandler("output.csv", ...)

    Also note that if you are using shiny modules (you probably would know if you are using this), then you want to use downloadButton(ns("myIdHere"),...) and then you still have output$myIdHere

    0 讨论(0)
  • 2020-12-01 15:18

    Note the download button does not work in the RStudio viewer. Your friend might be using the RStudio viewer to view the app. If that is the case, please open the app in the external web browser (there is a drop-down list on the right of the "Run App" button: Run in Window, Run in Viewer Pane, Run External; choose the last one).

    0 讨论(0)
提交回复
热议问题