【发布时间】:2017-08-22 23:00:25
【问题描述】:
我正在尝试制作一个闪亮的应用程序来进行计算,如 [this pape 有 3 种计算,称为“calcprior”、“calcpval”和“calcFPR”。
radioButton 选择要进行的计算。每个计算都需要不同的输入。输入被放置在条件面板中。正确的名称出现在条件面板中,但数值不会传递给服务器,例如input$pval 没有在条件面板的 numericInput 中输入的值。
相比之下,所有 3 次计算所需的 nsamp 值被正确传递到服务器。
我是 Shiny 的初学者,所以我希望有人能解释一下出了什么问题。无法看到变量的值使得调试比在常规 R 中困难一百万倍。
sidebarLayout(
sidebarPanel(
radioButtons("calctype", "Choose calculation:",selected = "calcFPR",
choices = c(
"prior (for given FPR and P val)" = "calcprior",
"P value (for given FPR and prior)" = "calcpval",
"FPR (for given P value and prior)" = "calcFPR")),
conditionalPanel(
condition = "input.calctype == 'calcprior'",
numericInput("pval", label = h5("observed P value"), value = 0.05, min
= 0, max = 1),
numericInput("FPR", label = h5("false positive risk"), value = 0.05,
min = 0, max = 1)
),
conditionalPanel(
condition = "input.calctype == 'calcpval'",
numericInput("FPR", label = h5("false positive risk"), value = 0.05,
min = 0, max = 1),
numericInput("prior", label = h5("prior probability of real effect"),
value = 0.5, min = 0, max = 1)
),
conditionalPanel(
condition = "input.calctype == 'calcFPR'",
numericInput("pval",label = h5("observed P value"),value = 0.05, min =
0, max = 1),
numericInput("prior", label = h5("prior probability of real effect"),
value = 0.5, min = 0., max = 1.)
),
inputPanel(
numericInput("nsamp",label = h5("Number in each sample"), step = 1,
value = 16, min = 2)
),
mainPanel(
(我还需要弄清楚如何使用 calctype 将服务器定向到适当的 R 代码块。)
【问题讨论】:
-
我弄乱了具有原始 R 代码的论文的链接,它位于 biorxiv.org/content/biorxiv/early/2017/08/07/144337.full.pdf
标签: r shiny radio-button conditional