在renderUI

时间:2017-08-10 19:59:09

标签: r user-interface shiny

我想在selectInput中使用renderUi的某些信息,例如所选项目的长度(renderUi取决于此数字)。 不幸的是我还没有找到解决方案。下面是一个简短的简化示例,它应该显示所选项目的长度。我想输入的返回类型或I / O的编码都存在问题。

请注意:我已经尝试了renderPrint,这是有效的!但我需要有关renderUi中selectInput长度的信息,因为我想根据所选的数字创建更多的ui元素。

Ui.R:

library(shiny)

shinyUI(fluidPage(
  selectInput("first","first",choices=c("a","b"),multiple=TRUE),
  uiOutput("hallo")
))

Server.R:

library(shiny)

shinyServer(function(input, output) {

  output$hallo <- renderUI({
    print(length(input$first))
  })

})

0 个答案:

没有答案