Write.table does not write to the file


#1

I am running the code below and the file is created in the download folder, however the content is not written. I thought that since the downloaded file n Firefox is temporary and it is set up to read only, changing the configuration in about:config would make the file writable. It did but this not fixed the problem. Is there anything else I can do?

output$contents <- renderTable({
    inFile = input$file
    if(is.null("inFile")){
      return()
    }
    req(inFile)
    input$inFile$name
    validate(
      need(file_ext(inFile) %in% c(
        'tsv'
      ), "Wrong File Format. The selected file is not a valid tab-separated PARAMS file try again! If
      you do not have a parameters.tsv file in your directory stop clycoPipe create a file and re-start glycoPipe"))
    read.table(inFile$datapath, sep = '\t')
    file <- inFile$datapath
   
  })
  datasetInput <- reactive(
    switch(input$dataset,
           "glycoPipe_PARAMS_TEMPLATE" = template
           #"Rock" = rock,
          # "Pressure" = pressure,
          # "Cars" = cars
    )
    
  )
  output$table <- renderTable({
    datasetInput()
  })
  output$downloadData <- downloadHandler(
    filename = function() {
      paste(input$dataset, input$filetype, sep = ".")
    },
    
    content = function(file) {
      sep <- switch(input$filetype, "tsv" = "\t")
      
      # Write to a file specified by the 'file' argument
      write.table(datasetInput(), file, sep = sep,
                  row.names = FALSE)
    }
  )