I have a pickerInput with three variables and I want when I select a variable I can set the mean and sd for each variable.
Then I am using these values to compute their distributions.
The problem is that this code sets mean and sd only to the first variable that I select.
Thank you in advance!
Here is a part of my code:
library(shiny)
library(shinyWidgets)
ui <-
fluidPage(
#3variables are g, m, c
checkboxInput("checkbox", label = "Use priors"),
uiOutput("conditionalInput"),
conditionalPanel(
condition = "input.priors == 'g'",
numericInput("mg", "Mean:", NULL, min = 0, max = 1000000),
numericInput("sdg", "Sd:", NULL , min = 0, max = 1000000)
),
conditionalPanel(
condition = "input.priors == 'm'",
numericInput("mm", "Mean:", NULL, min = 0, max =
1000000),
numericInput("sdm", "Sd:", NULL, min = 0, max = 1000000)
),
conditionalPanel(
condition = "input.priors == 'c'",
numericInput("mc", "Mean:", NULL, min = 0, max = 1000000),
numericInput("sdc", "Sd:", NULL, min = 0, max = 1000000)
)
)
server <- function(input, output, session) {
output$conditionalInput <- renderUI({
if (input$checkbox == TRUE) {
pickerInput("priors",
"Select priors",
c(
"r" = "g",
"m" = "m",
"K" = "c"
),
multiple = T)
}
})
}
shinyApp(ui = ui, server = server)