0

This is the code for my pickerInput in my shiny application. I want to sort all the choices alphabetically and force "Other" to come at the end of the list.

Here is my code and picture of pickerInput:

a <- c(unique(Data$Mode_group_new))


sidebarPanel(h3("Inputs for histogram"),
             pickerInput(inputId = "Mode_group_new",
                         label = "Select mode category",
                         choices = a,
                         multiple = T,
                         selected = a,
                         options = list(`actions-box`= TRUE)),

enter image description here

  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Feb 21 '22 at 22:52
  • The other question mentions ggplot but the relevant section of building the factor with the correct level order would work here as well. Use `choices = levels(a)` when you get the correct order that you want for the factor. – MrFlick Feb 21 '22 at 22:57

0 Answers0