The objective of the application is for the user to select some variables from the selectinput function in rshiny and based on whatever variables are selected there should be a corresponding numericinput box which takes the weightage of that variable as input.
So for example if I select four variable from the selectinput function then there should be 4 numericinput boxes which would prompt the user to enter the corresponding weightages.
I am able to do this using the checkbox option instead of selectinput function, but since the number of variables are huge checkbox option is not viable.
Using checkbox function the codes is as follows:
checkboxInput("pick", "Picked_up"),
conditionalPanel(
condition = "input.pick == true",
numericInput("var1","Enter the weightage of the variable","")
),
br(),
checkboxInput("c2", "%C2"),
conditionalPanel(
condition = "input.c2 == true",
numericInput("var2","Enter the weightage of the variable","")
),
br(),
checkboxInput("newfill", "Perc_Newfill"),
conditionalPanel(
condition = "input.newfill == true",
numericInput("var3","Enter the weightage of the variable","")
),
br(),
checkboxInput("rts", "%RTS"),
conditionalPanel(
condition = "input.rts == true",
numericInput("var4","Enter the weightage of the variable","")
)
I want to implement the same functionality for selectinput function, the code I tried is as follows:
ui.r
uiOutput('select_value'),
uiOutput('input_value'),
server.r
output$select_value <- renderUI({
selectInput('var_name','choose variables',names(descriptive_data),multiple = TRUE)
})
runInput2<- observeEvent(input$var_name,{
for(i in 1:length(input$var_name))
{
output$input_value <- renderUI({
mydata <- input$var_name[1]
numericInput('var', 'input weightage',"")
})
}
})
I am new to Rshiny and hence would be open to inputs suggestions as to what I am doing wrong and how can i implement this.