cant use a default file as input

Hi everybody,
I am trying to set my app script in order to work on a default csv file before users load their own files but it doesnt work: it load for a while then it stops. If I load the same file by clicking on "browse" button then the same file is processed and the script works.

this is my script:

library(DT)
library(shiny)

server <- function(input, output, server) {
    source("/srv/shiny-server/appSVA/svannotatrFunction.r")

    resultsSV <- reactive({
        if (is.null(input$bedfile)) {
            tabInDF <- read.table(file = "/path/to/test.bed", sep = "\t", header = T)
            functionA(tabInDF)
        } else {
            tabInDF <- read.table(file = input$test$datapath, sep = "\t", header = T)
            functionA(tabInDF)
        }
    })

    output$resultsTab <- DT::renderDataTable({
        req(input$bedfile)
        indTab <- match(input$choosenFeature, names(resultsSV()))
        resTab <- resultsSV()[[indTab]]
        return(resTab)
    })

    output$resultsPlot <- renderPlot({
        req(input$bedfile)
        indTab <- match(input$choosenFeature, names(resultsSV()))
        resTab <- resultsSV()[[indTab]]
        indPlot <- match(input$choosenValue, colnames(resTab))
        resPlot <- resTab[, indPlot]
        hist(main = paste0("Distribution of ", input$choosenValue), resPlot, breaks = input$bins, col = input$col, xlim = input$xlim)
    })
}```



any idea about the mistake? 
Thanks

https://shiny.rstudio.com/articles/debugging.html

Perhaps browser)_ after tabInDF and verify that it has been populated. It might be something as simple as you getting the path wrong.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Solved.
this

req(input$bedfile)

interrupts the script while generating outputs if the file was not uploaded so no output tables were shown if I were using the default file