How to download a file to the "Download" folder in shiny web? The code provided works fine in my local shinyApp but when it goes live on Shiny web it does not work.

observeEvent(input$select_yes, {
    data$raw$screened_abstracts[progress$row] <- "DONE"
    data$raw$time_screened[progress$row] <- Sys.time()
    filename <- paste(paste0(data$raw$recordid.[progress$row],"_", data$raw$id[progress$row],
                             "_",Sys.time()),"csv", sep = ".")
     filePath <- file.path("~/Downloads", filename)
     write.csv(data$raw[progress$row,], filePath, row.names = FALSE, quote = TRUE)
    if(input$hide_screened){ # progress$current remains the same and progress$available changes
      progress$available <- which($raw$screened_abstracts))
      progress$max_n <- length(progress$available)
      if(progress$current > progress$max_n){
        progress$current <- progress$max_n
    }else{ # i.e. if screened elements are visible, then current is used for navigation
      if(progress$current < progress$max_n){
        progress$current <- progress$current + 1

I think there is confusion here.
You appear to be directly writing a file to a location on your local.machine. this is conceptually only possible when the shiny server and the client machine are the same. If you want things to download via a browser you will need a download button and down load handler.

Thank you very much. That is very true however I wanted it to perform the function I wanted and thought there might be ideas when I posted it but seems its not possible in ShinyApp. I eventually had to specify this using the download button for now, perhaps someone might have some ideas.