#StackBounty: #r #shiny #shiny-server system commands in future/promises in Rshiny

Bounty: 50

I have the below server.R code in shiny app where a system command is run inside future which gives an output.vcf file. Upon creation of this file the progress bar is removed and a second system command is run to convert out.vcf to out.txt

The system commands are used as R could not read huge vectors on a 32Gb machine. Hence some system commands are used to process the data.

The output produced in the first system command i.e. out.vcf has to be rendered to downloadHandler and the output from the second command out.txt has to be returned to renderDataTable.

Could someone suggest an efficient way of doing this? possibly running both the system commands inside the future() and returning the outputs to downloadHandler and renderDataTable.

server <- function(input, output, session) {
file_rows <- reactiveVal()

observeEvent(input$run, {
  prog <- Progress$new(session)
  prog$set(message = "Analysis in progress",
    detail = "This may take a while...",
    value = NULL)

  path <- input$uploadFile$datapath
  nrows <- input$nrows

      paste0("head -", input$nrows) ,
      intern = TRUE)
  }) %...>%
    file_rows() %>%

observeEvent(req(file_rows()), {
updateTabsetPanel(session, "input_tab", "results")
    rows_input <- file_rows()

      paste(some system command"),
      intern = TRUE)

##How could we render the content of "out.txt" from the above system command to datatable in the below code#######  
    output$out_table <-
        options = list(
          searching = TRUE,
          pageLength = 10,
          scrollX = T

##How could we render the content of "out.vcf" from the first system command to downloadHandler in the below code#######    
output$out_VCFdownList <- downloadHandler(
      filename = function() {
        paste0("output", ".vcf")
      content = function(file) {
        write.vcf("out.vcf from first system command ", file)

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.