I don't have much experience working on shiny. I am trying to download the data by using DownloadHandeler function. I get nothing when I hit the download button.
My code:
ui: downloadButton('download',"Download the data"),
Server :
output$tb_cc <- DT::renderDataTable({
if (is.null(input$dataset_cc)) {
return(NULL)
}
library(dplyr)
library(tidyverse)
library(tidytext)
df <- filedata_cc()
df$date <- df$Responsedate
df$date <- as.Date(df$date, format = "%m/%d/%Y")
df <-
subset(df, df$date >= input$dateRange_cc[1] &
df$date <= input$dateRange_cc[2])
df <- subset(df, df$sentiment_segment == input$sentiment_cc)
df <- subset(df, df$Type.1 == input$issuetype_cc)
df<- df[c(3:10)]
DT::datatable(df)
})
output$download <- downloadHandler(
filename = function() { 'Sentiment_data.csv' },
content = function(file) {
write.csv(df(), file)
}
)
sample data : enter image description here