【问题标题】:How can I create x number of textInput which are arranged vertically?如何创建 x 个垂直排列的 textInput?
【发布时间】:2021-08-06 19:21:51
【问题描述】:

我有一个名为dat 的数据集,我可以找到x<-ncol(dat) 的列数。

我想创建垂直显示的 x 数量的文本输入。

我该怎么做?

【问题讨论】:

    标签: r shiny shinydashboard shiny-server shinyapps


    【解决方案1】:

    这是一个简单的例子,lapply 和 iris 数据集 -

    library(shiny)
    
    dat <- iris
    x<-names(dat)
    
    ui <- fluidPage({
      uiOutput('textInput')
    })
    
    server <- function(input, output) {
      output$textInput <- renderUI({
        lapply(x, function(name) textInput(name, name))
      })
    }
    
    shinyApp(ui, server)
    

    【讨论】:

      猜你喜欢
      • 2021-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多