rookie question: return sliderinput as textoutput

Hi all,

I would like to implement a slider whose inputvalue should be returned as text. I try to build it, but it returns the error "argument 1 (type 'list') cannot be handled by 'cat'" if I try to run it.

Does someone know how to make the text show up?

I included an example of how I tried to build it below.

Thanks a lot!

library(shiny)

ui <- fluidPage(
    
            
            sliderInput("PTLS", label = NULL, 0, 20, 2.5, step = 0.1),
            
            textOutput("value")

    )

server <- function(input, output) {

    l <- reactive({
        
        data.frame(
            Value = as.character(c(input$PTLS)))
    })
    
    output$value <- renderText({
        l()
    })
    
}

shinyApp(ui, server)

Is this what you are after?

library(shiny)

ui <- fluidPage(
  
  
  sliderInput("PTLS", label = NULL, 0, 20, 2.5, step = 0.1),
  
  textOutput("value")
  
)

server <- function(input, output) {
  
  output$value <- renderText({
    input$PTLS
  })
  
}

shinyApp(ui, server)

You could also use renderUI() with htmlOutput().

image

1 Like

Yes indeed, thank you very much! :slight_smile:

1 Like

This topic was automatically closed 7 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.