How change default selected value for "radioButtons" UI element?

I have R Shiny app with the "radioButtons" element and default selected value is "1".

radioButtons("rbtn_metrics", "Metric", choices = list("Metric_1" = 1, "Metric_2" = 2, "Metric_3" = 3), selected = 1)

Let say user selected the second element (2) and see data for "Metric_2".

Then he makes other selections, UI is updated, and radioButtons element set by default to "1".

How to keep the second element (2) as a default selected value in this case?


Use updateRadioButtons(session, selected = as.integer(input$rbtn_metrics)) when UI is updated

We can give you better help if you turn this into a reproducible example

1 Like

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