Unable to use "Save as" function to save generated .CSV files and compile them into a zip file on Windows OS

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=" ")))
}

Hi everyone who read this email and is looking for answers,

I would just want to update here that I managed to resolve it on my own.

The code will only work if you open the shinyapp through a browser and not through the viewer pane or Rstudio viewer in Windows OS. It works normally in Ubuntu.

Refer to : How to download multiple reports created using R markdown and R shiny in a zip file

PS: Unsure if you need to also install RTools and add it to your devtools package.

Just in case it is needed , you can refer to :

Chapter 9 Set up an R dev environment | What They Forgot to Teach You About R and https://ohdsi.github.io/Hades/rSetup.html#:~:text=your%20Start%20Menu.-,Installing%20RTools,Select%20the%20default%20options%20everywhere.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.