I want to build an R shiny app that has a dynamic input that asks the user for a numeric input and then based on that input generates 4 more input fields. Here is what I have in mind.
library(shiny)
# Define UI for random distribution application
shinyUI(fluidPage(
# Application title
titlePanel("Calcs"),
# Sidebar with controls to select the random distribution type
# and number of observations to generate. Note the use of the
# br() element to introduce extra vertical spacing
sidebarLayout(
sidebarPanel(
numericInput("dorr", "How many inputs do you want",4),
i = i+1
while(input$dorr<i){
numericInput("S", "Number of simulations to run:", 10)
i=i+1
}
numericInput("S", "Number of simulations to run:", 10),
actionButton(inputId = "submit_loc",label = "Run the Simulation")
),
mainPanel(
)
)))
I know the above code doesn't work, but it is my rationale. I know that Shiny has conditional statements but I can't seem to find one that allows me to generate a pre-specified number of additional fields. Is this even possible?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…