我正在制作一个简单的Shiny App,我想为最终用户提供从列表中选择与矢量对应的地理位置的机会:
> lst.geos
[1] Geo A Geo B Geo C Geo D
[5] Geo E Geo F Geo G
我正在努力连接我的列表,所以如果在第一个列表中选择地理位置,我希望第二个列表中的地理位置消失 ,就像在这个特定应用的背景下,两次选择相同的地理是没有意义的。我ui.R
的摘录如下:
ui.R
h4("Geographies"),
# Provide selections for local authorities
selectInput("selectGeoOne", label = h5("Geography 1"),
choices = lst.geos, selected = 1),
selectInput("selectGeoTwo", label = h5("Geography 2"),
choices = lst.geos[lst.geos != input$selectGeoOne],
selected = 2)
我只是尝试使用lst.geos[lst.geos != input$selectGeoOne]
对第二个向量进行子集化,但我收到错误消息:Error in NextMethod("[") : object 'input' not found
。我猜这个问题在于Shiny的范围规则。因此,我的问题是,如何正确引用ui.R
中的ui.R
元素?