79459539

Date: 2025-02-22 11:41:35
Score: 2
Natty:
Report link

How about using ShinyWidget's radioGroupButtons?

out

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  radioGroupButtons( 
    inputId = "choice",
    label = "Choice: ",
    choices = c("Option 1", "Option 2"),
    selected = "Option 1",
    individual = T
  ),
  textOutput("selected_choice")
)

server <- function(input, output, session) {
  
  output$selected_choice <- renderText({
    paste("Selected:", input$choice)
  })
}

shinyApp(ui, server)
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): How
  • High reputation (-1):
Posted by: Tim G