Hello. First post in the forum, and new to Shiny. I am trying to to write multiple csv files of processed data, which was processed in the Shiny app, and zip them up to download. I have been struggling for about two weeks! I have tried with and without downloadHandler. I am only able to write and download one file at a time. Could anyone help?
Note: The original uploaded data is in list s, and there are two types of data you can download (stored in datasetInput).
Thank you!
output$downloadZip <- downloadHandler(
filename = function(){
paste("maldiprocresults",".zip")
},
content = function(con){
tmpdir <- tempdir()
setwd(tempdir())
filestosave=c()
for (i in 1:length(s)){
x<-as.matrix(datasetInput()[[i]])
f<-(paste("maldiprocres", names(s)[[i]], sep="_" ))
filestosave=c(filestosave,write.csv(x,f))
}
zip(zipfile=con, files=filestosave)
},
contentType = "application/zip"
)