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()
})
}