Create selectInput() choices based on numericInput in a shiny app


#1

I have a simple shiny app:

#ui.r
navbarPage(
  "Application",
  tabPanel("General",
           sidebarLayout(

             sidebarPanel(
               uiOutput("tex2"),
               br(),
               uiOutput("select")


              ),

             mainPanel(


             )
           )))
#server.r
library(shiny)

server <- function(input, output,session) {

  output$tex2<-renderUI({
    numericInput("text2","#tests",
                 value = 1,
                 min=1
    )
  })
  output$select<-renderUI({

    selectInput("sel", label = "Select Test",
                for(i in 1:input$text2){
                  choices = list(paste("Test",i) == i)},selected = input$text2

    )


  })

}

As you can see it includes a numericInput() and a selectInput(). What I want to achieve is to create the number of selectInput() choices and their names based on the numericInput(). For example if I choose "2" in the numericInput() the selectInput() should have 2 choices with names "Test1","Test2".