I tried to right a simple equivalent of the real program. The real program reads a file, extracts one column and converts it into a list. Here I am using a dummy list. If I return a single value, everything works fine. This is what I get when I run app.R: "error: argument 1 (type 'list') cannot be handled by 'cat'"
I could not make reprex() work this time. I will keep trying
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
column(width = 10,
conditionalPanel(
condition = "input.btn == true",
selectInput("value", label = h4("Do you have a params file ready to use (Y/N)?"),
choices = c("", "Y", "N"), selected = NULL)
),
conditionalPanel(
condition = "input.value == 'Y'",
helpText(h4("Select your params file")),
fluidRow(
column(width = 10, fileInput("file", "upload the file", accept = ".tsv", placeholder = "No file selected", multiple = FALSE))
)
# useShinyjs(), # Include shinyjs
# extendShinyjs(text = jscode, functions = c("closeWindow")),
#actionButton("close", "Stop glycoPipe")
)
)
),
mainPanel(
textOutput("checkedFile")
)
)
)
glycoPipe <- function(inFileName){
list[valid, outL] <- extractParams(filename)
list(valid = valid, outL = outL)
}
extractParams <- function(filename){
valid = "valid"
outL <- list(1,2,3,4,5)
return(list(valid, outL))
}
server <- function(input, output){
output$contents <- renderTable({
inFile = input$file
inFileName = input$file$name
if(is.null("inFile")){
return()
}
req(inFile)
validate( need(file_ext(inFile) %in% c(
'tsv'
), "Wrong File Format. The selected file is not a valid tab-separated PARAMS file try again. If
you do not have a parameters.tsv file in your directory stop clycoPipe create a file and re-start glycoPipe"))
read.delim(inFile$datapath, quote = "", sep = '\t')
})
output$checkedFile <- renderText({
inFile <- input$file
inFileName <- input$file$name
result <- glycoPipe(inFileName)
result$outL
})
}
shinyApp(ui = ui, server = server)