I have built an application that stores a data frame in a reactive value. I then have a UI download button which downloads that data frame into a CSV file. It works well until the CSV file gets really big. I'd estimate around 100MB but it's hard to be sure.
My code is unremarkable - but a minimal reproducible example might be as follows. Seems that there may be a difference from running it locally and running it in on my Shiny Server instance (Amazon EC2).
ui.R
shinyUI(downloadButton("goDownload","Download Large File"))
server.R
library(shiny)
shinyServer(function(input, output, session) {
op <- reactiveValues(data = NULL)
op$dataOp<-data.frame(col1=seq(0:30000000),col2=seq(30000000:0)
dataOp <- reactive({
if (!is.null(op$dataOp)){
op$Labels
} else {
print("no op$dataOp")
}
})
output$goDownload<- downloadHandler(
filename = function() { paste('Data.csv', sep='') },
content = function(filename) {
write.csv(dataOp(), filename, row.names = F)
})
})