以下是我半完成的代碼
library(shiny)
# Define UI for dataset viewer app ----
ui <- fluidPage(
# App title ----
titlePanel("Medical Diagnosis"),
sidebarLayout(
sidebarPanel(
numericInput(inputId = "sensitivity",
label = "Number of Sensitivity to view:",
value = 0.9,min=0,max=1),
numericInput(inputId = "specificity",
label = "Number of Specificity to view:",
value = 0.8,min=0,max=1),
numericInput(inputId = "prevalence",
label = "Number of Prevalence to view:",
value = 0.7,min=0,max=1),
numericInput(inputId = "times",
label = "Number of Inspections to view:",
value = 1,min=1),
submitButton("Update View"),
),
mainPanel(
# Output: Formatted text for caption ----
tableOutput("values")
)
))
server <- function(input, output) {
numericValues <- reactive({
data.frame(
Name = c("Sensitivity",
"Specifity",
"Prevalence",
"Number of Inspections",
"Positive predicted value",
"False discovery rate"),
Value = as.character( c(input$sensitivity,
input$specificity,
input$prevalence,
input$times,
input$ppv,
input$fbr
)),
stringsAsFactors = FALSE)
})
output$values <- renderTable({
numericValues()
})
}
shinyApp(ui, server)
上面ppv和fbr是輸入的三個值計算出來的,下面是計算公式
ppv<-(sensitivity*prevalence)/(prevalence*sensitivity+(1-specificity)*(1-prevalence)),
fdr<-(1-sensitivity)*prevalence/((1-sensitivity)*prevalence+(1-prevalence)*specificity),
不管我插到那都是錯誤的,提示找不到物件sensitivity。
請教各位大大幫我指正!謝謝!
uj5u.com熱心網友回復:
挺急的大佬幫幫忙呀
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/79419.html
標籤:其他開發語言
上一篇:scrapy框架爬蟲翻頁問題
