I am trying to use Shiny inline within an Rmarkdown document. In this simple example, I want to create 3 inputs: the first allows you to choose one or more of 4 countries ("GHA","RWA","TZA","UGA"). In the real app, I want the landscapes options to update based on the actual landscapes available in the selected countries. However, in this example, I just want the initial view (when "GHA" is selected by default) to be "L01" to "L06". Then, if any changes are made to the "countries" input, the landscape options would change to ("hmm","hum"). I have read that in some cases observe vs reactive options might be preferred and have tried a variety of variations, but essentially any time I include an updateSelectInput command I lose any options for landscapes in the app. Thanks for any insights!
library(shiny)
selectInput("countries", 'Country',
list("GHA","RWA","TZA","UGA"),
multiple=TRUE,
selectize=TRUE,
selected="GHA")
checkboxGroupInput("landscapes", label=("Landscape"),
choices=c("L01","L02","L03","L04","L05","L06"), selected="L01")
radioButtons("checkPlot", label = ("Factors"),
choices=c("Gender of Household Head", "Water Source(s)"),
selected = "Water Source(s)")
observeEvent(input$countries, {
updateSelectInput(session, "landscapes", choices=c("hmm","hum")) })