How to Render content to table from file output in Shiny

0down votefavorite

I have the below sample code where a series of system commands were run in the server code and the output from the file need to be rendered to the table item. I have commented in the code what is required. Could someone help what is wrong in there. It stays idle and nothing is rendered at the moment.

 library(shiny)

ui <- fluidPage(
fileInput("CF", label = "CF"),
fileInput("ED", label = "ED"),
 actionButton("Run", "Run"),
 menuItem("Table",tableOutput("table"),icon = icon("table"))
)

server <- function(input, output, session) {
cf_file <- reactive({ 
cfFile <- input$CF
return(cfFile$datapath)
})

ed_file <- reactive({ 
edFile <- input$ED
return(edFile$datapath)
})

table_content <- eventReactive(input$Run, {
req(input$ED$datapath)
req(input$CF$datapath)
file_ed <- ed_file()
file_cf <- cf_file()
##first command outputs file1.txt###
system(paste("cat ",file_ped, "| head > file1.txt"))
###second command uses file1.txt and outputs file2.txt
system(paste("cat file1.txt", file_cf,"> file2.txt"))
##How can i render the output from file2.txt to table_content?##
})

output$table <- renderText({
req(table_content())
table_content()
})
}

Hi,

I noticed your post is also here:

https://stackoverflow.com/questions/52624111/render-content-to-table-from-file-output-in-shiny#

At a minimum, we ask that if you cross post you at least link to that post here, and keep the status of your question updated, as to avoid duplication of effort.

Please see the FAQ here:

2 Likes

thanks for letting me know about cross posting. I will consider this in future and im afraid that duplication of effort turned out to be zero effort in this case. I wonder if this is because of duplicated post and readers assuming that it will be answered at the other source :pensive: