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?
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)