我想讓一個Shiny應用程序做計算,如[本文檔 有3種計算,稱爲「calcprior」,「calcpval」和「calcFPR」。帶有條件面板中的數值輸入的單選按鈕
要完成哪個計算是由radioButton選擇的。每個計算需要不同的輸入。輸入放置在conditionalPanels中。正確的名字出現在onPanel上,但數字值不會傳遞給服務器,例如輸入$ 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代碼的論文的鏈接,它位於 http://www.biorxiv.org/content/biorxiv/early/2017/08/07/144337.full.pdf –