How can I create x number of textInput which are arranged vertically?

Viewed 29

I have a dataset called dat and I can find the number of columns present by x<-ncol(dat).

I want to create x number of textinputs which are shown vertically.

How can I do that?

1 Answers

Here's a simple example with lapply and iris dataset -

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)

enter image description here

Related