mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-01 18:24:54 -05:00
20 lines
438 B
R
20 lines
438 B
R
shinyServer(function(input, output) {
|
|
datasetInput <- reactive({
|
|
switch(input$dataset,
|
|
"rock" = rock,
|
|
"pressure" = pressure,
|
|
"cars" = cars)
|
|
})
|
|
|
|
output$table <- renderTable({
|
|
datasetInput()
|
|
})
|
|
|
|
output$downloadData <- downloadHandler(
|
|
filename = function() { paste(input$dataset, '.csv', sep='') },
|
|
content = function(file) {
|
|
write.csv(datasetInput(), file)
|
|
}
|
|
)
|
|
})
|