How to render a list


My function returns a list that contains a list and a variable
return(list(list(X), variableName))

[A, B] <- functionName(filename)

I try to use renderText(), but I get the error: list cannot be handled by cat().

How can I print the list -list(X) -returned by the function.


You need to include a reprex of your code so we can duplicate what happens when you run it. It should contain the input your code needs and produce the output or error you are encountering. If possible you should show the results you are looking for.

There are lots of people here who want to help you get your code working but you have to do your part by making it as easy as possible for them to do that. Posting your code in a reprex is the way to do that.

Here is a link that explains reprex:

If you have any problems with reprex’s just post another topic here and you will get a lot of help get reprex’s working.


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


ui <- fluidPage(
      column(width = 10,
               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)
               condition = "input.value == 'Y'",
               helpText(h4("Select your params file")),
                 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")

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
    validate( need(file_ext(inFile) %in% c(
    ), "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)

shinyApp(ui = ui, server = server)


I fixed the problem by using renderUI({}) instead of renderText({}). It seems that renderText({}) can not be used with lists.