9.3 Downloads

9.3.1 UI

  • For file downloads, use downloadButton(id, label) or downloadLink(id, label).
  • Customize the appearance with the class or icon arguments.

9.3.2 Server

In the server, use downloadHandler(filename, content). There are only 2 arguments, both are functions.

  • filename - no arguments. Returns file name as a string.
  • content(file) - one argument (file). Path to save the file.
output$download <- downloadHandler(
  filename = function() {
    paste0(input$dataset, ".csv")
  },
  content = function(file) {
    write.csv(data(), file)
  }
)