I have a select box in a shiny app which I am trying to use outputOptions so that it will render all the tabs in my report generated using r-markdown. Below is the code for that: 
observeEvent(input$tab, {
  if (input$tab == "fruits"){
    choices <- c(
      "Apples",
      "Oranges"
    )
  }
  else if (input$tab == "vegetables") {
    choices <- c(
      "potatoes",
      "squash"
    )
  }
  else {
    choices <- c(
      "berries",
      "onions"
    )
  }
  updatePickerInput(session,
                    inputId = "selected_metric",
                    choices = choices)
})
outputOptions(output, "selected_metric", suspendWhenHidden = FALSE)
The following is the error I get
Error in .subset2(x, "impl")$outputOptions(name, ...) : selected_metric is not in list of output objects