Examples for 'shiny::downloadHandler'


File Downloads

Aliases: downloadHandler

Keywords:

### ** Examples

## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
  downloadButton("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)
}
Error in loadNamespace(name): there is no package called 'webshot'

[Package shiny version 1.5.0 Index]