Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
记住并显示R应用程序中的所有用户输入?_R_Shiny - Fatal编程技术网

记住并显示R应用程序中的所有用户输入?

记住并显示R应用程序中的所有用户输入?,r,shiny,R,Shiny,在R Shining应用程序中,是否有方法记住所有用户输入并打印结果 当前的应用程序将允许用户上传一个.csv数据文件,然后他们可以进入其中一个概率选项卡并输入新的数据信息。这将为每个新条目提供一个新的预测概率 例如,如果用户为“FIB-4”输入一个新值,他们将得到输出“新的FIB-4值为:[值],并且每次用户提交一个新的FIB-4值时,新的预测值是[预测概率]。因此,主面板将显示新的FIB-4值,例如4和10: “新的FIB-4值为:4,新的预测值为0.48” “新的FIB-4值为:10,新的

在R Shining应用程序中,是否有方法记住所有用户输入并打印结果

当前的应用程序将允许用户上传一个.csv数据文件,然后他们可以进入其中一个概率选项卡并输入新的数据信息。这将为每个新条目提供一个新的预测概率

例如,如果用户为“FIB-4”输入一个新值,他们将得到输出“新的FIB-4值为:[值],并且每次用户提交一个新的FIB-4值时,新的预测值是[预测概率]。因此,主面板将显示新的FIB-4值,例如4和10:

“新的FIB-4值为:4,新的预测值为0.48”

“新的FIB-4值为:10,新的预测值为0.58”

我从和中看到,
reactiveValue
可能是一种方法,但是我需要一个“order”计数器来按顺序保存所有值吗

ui<-navbarPage("R268 - Fibroscan analysis (Program adapted from Subhasish code) ",
           tabPanel("Data Import",
                    sidebarLayout(sidebarPanel( fileInput("file","Upload your CSV",multiple = FALSE),
                                                tags$hr(),
                                                h5(helpText("Select the read.table parameters below")),
                                                checkboxInput(inputId = 'header', label = 'Header', value = FALSE),
                                                checkboxInput(inputId = "stringAsFactors", "stringAsFactors", FALSE),
                                                radioButtons(inputId = 'sep', label = 'Separator', 
                                                             choices = c(Comma=',',Semicolon=';',Tab='\t', Space=''), selected = ',')
                    ),
                    mainPanel(uiOutput("tb1"))
                    ) ),
 tabPanel("Probability of discordance between fibroscan and biopsy",
                    sidebarLayout(sidebarPanel( 
                      numericInput("fib4", "Enter new FIB-4 value:", 1.72, min = 0, max = 20),

                      actionButton("update2", "Update")
                    ),
                    mainPanel(helpText("The probability of discordance between Fibroscan and biopsy is: "),
                              verbatimTextOutput("print_prob2"))
                    ) )
)
server<-function(input,output) { 

   data <- reactive({
   file1 <- input$file
   req(file1) 
   read.table(file=file1$datapath, sep=input$sep, header = input$header, stringsAsFactors = input$stringAsFactors)
 })
output$table <- renderTable({
     if(is.null(data())){return ()}
     data()
})
output$tb1 <- renderUI({
     tableOutput("table")
})
prob_discFibBiop<-eventReactive(input$update2,{
    if(is.null(data())){return ()}
    rm(list = ls())
    f<-data()

    subdat <- f[,c("Dis.Fibrosis.FS.vs.Bx..0.no.discordance..1.Results.discordant..Adv_vs_NonAdv","Fib4")]
    subdat <- subdat[complete.cases(subdat),]

    library(caret)
    form <- sprintf("%s~%s","Dis.Fibrosis.FS.vs.Bx..0.no.discordance..1.Results.discordant..Adv_vs_NonAdv",c("Fib4"))

    logreg <-glm(as.formula(form),family=binomial(),data=subdat)
    pred <- predict(logreg, newdata=data.frame(Fib4 = input$fib4),type="response")
    pred <- round(pred, 2); pred.output <- cbind(pred,1-pred); colnames(pred.output) <- c("Discordant","No discordance")
    return(pred.output)
 })

output$print_prob2 <- renderPrint({

  print.output <- paste0("New FIB-4 input: ", input$fib4, " will result in ", prob_discFibBiop())
  print(print.output)
})
}
shinyApp(ui=ui,server=server)

uiI试图分析你的应用程序,但你的代码没有针对.csv输入进行动态分析。
Dis.Fibrosis.FS.vs.Bx..0.no.discordance..1.Results.discordant..Adv_vs_NonAdv“
这不应该是闪亮应用程序中的列名。提供一些关于github的示例数据,我可能会帮助您。对不起!我在这里上传了一个示例数据:我选择了未定义的列:-(在上传数据时,您可能必须选中“Header”和“stringAsFactors”复选框。很抱歉,我还没有使其适用于其他情况(目前)。我试图分析你的应用程序,但你的代码没有针对.csv输入进行动态分析。
Dis.Fibrosis.FS.vs.Bx..0.无不一致..1.结果不一致..Adv_vs_NonAdv
这不应该是闪亮应用程序中的列名。请在github上提供一些示例数据,这样我就可以帮助您了。对不起!我已在此处上载了示例数据:我选择了未定义的列:-(您可能必须选择“标题”和“stringAsFactors”)当你上传数据时,请勾选复选框。很抱歉,我还没有使它适应其他情况。