我對閃亮相當新穎,而且我知道y的問題相當簡單,但儘管做了大量的研究,但我似乎無法使閃亮渲染輸出比例功率的測試。我試圖在用戶輸入所有參數(p1,p2,sig.level,power)的情況下創建腳本,並給出樣本大小n。我嘗試了許多不同的方法,但通常最終沒有輸出,或者錯誤「n」,「p1」,「p2」,「power」和「sig.level」中的某一個必須爲NULL「 。任何幫助表示讚賞,謝謝!針對樣本尺寸的power.prop.test函數的閃亮渲染輸出
到目前爲止我的代碼:
ui<-shinyUI(fluidPage(
headerPanel("Power Calculator"),
fluidRow(
column(12,
wellPanel(
helpText("This calculator can help you understand the power of
your experimental design to detect treatment effects. You
can choose
between a standard design in which individuals are randomly
assigned to treatment or control
and a clustered design, in which groups of individuals are assigned to treatment
and control together."),
column(4,
wellPanel(
numericInput('p1a','prop1', value = 0.12, min = 0.01, max = 0.99),
numericInput('p2a', 'prop2', value = 0.14, min = 0.01, max = 0.99),
numericInput('sig.levela','significance level' , value = 0.95, min = 0.9, max = 0.99),
numericInput('powera', 'power level', value = 0.8, min = 0.75, max = 0.99)
),
column(8,
wellPanel(
htmlOutput("nrequired")
)
)
)
)
)
)
)
)
)
server<-shinyServer(
function(input, output) {
sample.size<-reactive({
p1<-input$p1a
p2<-input$p2a
sig.level<-input$sig.level$a
power<-input$power.levela
})
output$nrequired <- renderPrint({
power.prop.test(sample.size)
print(sample.size)
})
}
)
shinyApp(ui=ui,server=server)
請不要大寫R函數的名稱,當它們沒有實際上限制時。它混淆了其他新手。 (錯誤信息似乎很合理清楚,你提供了一個參數,並預期有四個函數。) –
對不起,你指的是什麼capitilization?我還補充說,當我提供所有參數(p1,p2,sig.level和power)時,我得到這個錯誤 –
「Power.Prop.Test函數」 –