Hi all, I am having issues getting this code to work properly.
When i click on the save "results table" button in my ShinyApp, the files generated ended up in the same folder where my app.R files is located. The save as function appears , but it turns out that that function is obsolete. This function worked on Linux but not on Windows and I couldnt figure out the reason behind this.
Is this a glitch and if so , is there another way of writing the code to fix this issue on Windows?
I was being told that it is a glitch on Windows but it was a while back and I would want to check if there is a better way to write the code to get it to work properly.
The code in question :
#Download Results tables
output$downloadTable <- downloadHandler(
options(scipen = 999),
filename = function(){
"chromosome_count_tables.zip"
},
content = function(file){
compare_tbl_list <- compare_all(files = dataPlotInputBAMSegment(),
ref = ReferenceInputBAMSegment(), window = T,
per = T, compare_from_normal = FALSE)
segment_plot_tbl_all <- segment_tbl_create_all(compare_tbl_list)
segment_annotation_tbl_all <- segment_annotation_tbl_create_all(segment_plot_tbl_all)
segment_annotation_tbl_all <- change_color_all(segment_annotation_tbl_all)
final_tbl_all <- show_table_all(files = segment_plot_tbl_all, annotation_files = segment_annotation_tbl_all)
files <- NULL;
#loop through the sheets
for (i in 1:length(final_tbl_all)){
#write each sheet to a csv file, save the name
fileName <- paste(input$fileBAMSegment[i,1],"_",i,".csv",sep = "")
write.csv(final_tbl_all[i],fileName,row.names = F)
files <- c(fileName,files)
}
#create the zip file
system2("zip", args=(paste(file,files,sep=" ")))
}