【发布时间】:2016-02-08 09:15:01
【问题描述】:
是否可以使用类似于谷歌搜索的自动完成字符串和闪亮文本框中的堆栈溢出标签选择来选择多个值。
dataset<-cbind("John Doe","Ash","Ajay sharma","Ken Chong","Will Smith","Neo"....etc)
我想从上述数据集中选择多个变量作为自动填充我的文本框并将其传递给我的服务器。R
ui.R
shinyUI(fluidPage(
titlePanel("test"),
sidebarLayout(
sidebarPanel(
helpText("text"),
textInput("txt","Enter the text",""),
#Pass the dataset here for auto complete
),
mainPanel(
tabsetPanel(type="tab",tabPanel("Summary"),textOutput("text2"))
)
)
))
服务器.R
# server.R
shinyServer(function(input, output) {
output$text2<- renderText({
paste("hello",input$txt)
})
}
)
已编辑
我使用了来自 shinysky 的 select2input 来选择多个变量,但现在我添加了提交按钮来将选定的值放在一起。
#ui.R
select2Input("txt","This is a multiple select2Input",choices=c("a","b","c"),selected=c("")),
actionButton("go","submit")
我想绑定选定的选项让我们说用户选择了 a 和 c 然后新变量是
#server.R
input$go #if pressed submit button
var<-cbind("a","c")
output$text<-renderText({ print ("var")})
但这不起作用
【问题讨论】:
-
您的编辑是一个基本问题,您应该阅读
shiny,因为这些事情非常简单。我将再次编辑我的问题,但下次发布一个新问题
标签: r autocomplete textbox shiny