【发布时间】:2015-10-20 00:08:21
【问题描述】:
我尝试制作这样的选择菜单:
Interactively change the selectInput choices
除了一件事之外,一切都很好: 虽然我没有做任何不同的事情(见下面的图片链接),但我得到了索引,而不是获取值(如麦当劳)。我的错误在哪里?
这里是我的 global.R:
partners<- read.csv("genes.csv", header=TRUE, fill=TRUE)
服务器.R
shinyServer(function(input, output) {
#subTable
searchResult<- reactive({
subset(partners, grepl(input$nameSearch, partners$name))
})
output$searchResults <- renderTable({
searchResult()[,1]
})
output$selectUI <- renderUI({
selectizeInput("partnerName", "Click in and select", choices=searchResult()[,1], multiple=TRUE )
})
})
ui.R
library(shiny)
shinyUI(pageWithSidebar(
# Give the page a title
titlePanel("Tilte"),
sidebarPanel(
textInput("nameSearch", "Search for name", "Blah"),
htmlOutput("selectUI"),
br(),
submitButton("Update View"),
br()
),
# Create a spot for the barplot
mainPanel(
textOutput("text"),
plotOutput("plot")
)
)
)
【问题讨论】: