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