3 つの変数を持つ pickerInput があり、変数を選択するときに、変数ごとに平均値と標準偏差を設定できるようにしたいと考えています。
次に、これらの値を使用して分布を計算しています。
問題は、このコードが mean と sd を選択した最初の変数にのみ設定することです。
前もって感謝します!
ここに私のコードの一部があります:
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)