Description Usage Arguments See Also Examples
Use these functions to create a download button or link; when clicked, it
will initiate a browser download. The filename and contents are specified by
the corresponding downloadHandler()
defined in the server
function.
1 2 3 | downloadButton(outputId, label = "Download", class = NULL, ...)
downloadLink(outputId, label = "Download", class = NULL, ...)
|
outputId |
The name of the output slot that the |
label |
The label that should appear on the button. |
class |
Additional CSS classes to apply to the tag, if any. |
... |
Other arguments to pass to the container tag function. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.