0

I have a shiny app where I am using downloadHandler/downloadButton to download a table. I have currently implemented the download to csv file. But would like to be able to download the same table as both csv and tsv file by clicking that one button. Is that possible ?

This is my code for the server side:

output$downloadTable <- downloadHandler(

  filename = function() {
    paste("type1_drugs_table_",Sys.Date(),".csv",sep="")
  },
  content = function(file) {
        write.csv(Type1(), file, row.names = FALSE, quote=FALSE, sep="\t")
    }
  }, # end of content

)

kay
  • 1,851
  • 3
  • 13
  • 14
  • Possible duplicate of [Download multiple csv files with one button (downloadhandler) with R Shiny](https://stackoverflow.com/questions/43916535/download-multiple-csv-files-with-one-button-downloadhandler-with-r-shiny) – vladli Sep 10 '19 at 12:39

2 Answers2

0

You can have a select input to choose which data set to download. See the example here: https://shiny.rstudio.com/articles/download.html

If you want two files downloaded at once see Download multiple csv files with one button (downloadhandler) with R Shiny

novica
  • 655
  • 4
  • 11
0

Thank you for the response. Yes I'm aware of the input selection option. We already had a lot of other settings that the user had to choose in the left panel. So were looking to avoid yet another input selection for this. Also saw the zip file option. I guess that's the only way to go then.

kay
  • 1,851
  • 3
  • 13
  • 14