Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. library(shiny)
  2.  
  3. if (interactive()) {
  4.  
  5. ui <- fluidPage(
  6. downloadButton("downloadData", "Download")
  7. )
  8.  
  9. server <- function(input, output) {
  10. # Our dataset
  11. data <- mtcars
  12.  
  13. output$downloadData <- downloadHandler(
  14. filename = paste("example",gsub(":","-",Sys.time()), ".csv", sep=""),
  15. content = function(file) {
  16. write.csv(mtcars,file)
  17. }
  18. )
  19. }
  20.  
  21. runApp(list(ui=ui,server=server),launch.browser=T)
  22. }
  23.  
  24. library(shiny)
  25.  
  26. if (interactive()) {
  27.  
  28. ui <- fluidPage(
  29. downloadButton("downloadData", "Download")
  30. )
  31.  
  32. server <- function(input, output) {
  33. # Our dataset
  34. data <- mtcars
  35.  
  36. output$downloadData <- downloadHandler(
  37. filename = function(){
  38. paste("example",gsub(":","-",Sys.time()), ".csv", sep="")
  39. },
  40. content = function(file) {
  41. write.csv(mtcars,file)
  42. }
  43. )
  44. }
  45.  
  46. runApp(list(ui=ui,server=server),launch.browser=T)
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement