Update a selectInput with data.frame values

I am trying to update a selectInput with a value from dataframe based on an input value. When I run the app I get an unsed argument error.
ui <- fluidPage(
sliderInput("controller", "Controller", 0, 20, 10),
textInput("inText", "Input text"),
textInput("inText2", "Input text 2"),
selectInput("selval",label = "Change Selection", choices = c(7,6,5,4,3.5,3,2,1))
server <- function(input, output, session) {

ls_data_df <- data.frame(
"category" = c("College","High School","University","Middle","Elementary")
,"dpw" = c(1,2,2,5,6)
,"hpw" = c(8,15,15,35,40)


x1 <- input$inText2
x2 <- ls_data_df[ls_data_df$category == x1, "dpw" ]
updateSelectInput(session, "selval", value = x2)


Hi @willhog5. From the error message Warning: Error in updateSelectInput: unused argument (value = x2). The problem come from the value = x2 and updateSelectInput function did not have value argument. If you want to update the selection of the input, change it to updateSelectInput(session, "selval", selected = x2) will do.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.