我没有 renderText 的输出

I had nothing as output of renderText

我正在开发 r 闪亮界面,但我被一些基本功能(如 renderText)阻止了,我的界面上什么也没有

我有多种方法:单独使用 textOutput 和 renderText,但我最后一次尝试是 paste0,但遗憾的是它没有用。


library(shiny)

if (interactive()) {

  ui <- fluidPage(
    numericInput("gdat10", "Gold difference at 10:00", ""),
    numericInput("gdat15", "Total gold earned at 15:00", ""),
    numericInput("fb", "First blood kill", ""),
    numericInput("teamkills", "Total kills by team", ""),
    numericInput("teamdeaths", "Total deaths by team", ""),
    numericInput("ft", "First tower of game killed", ""),numericInput("teamdragkills", "Total dragons killed by team", ""),
    numericInput("oppdragkills", "Total dragons killed by opposing team", "")
  )

  server <- function(input, output) {



    output$txtOutput = renderText({
    paste0("The result is ", 1/1+exp(0.9241448 +input$gdat10*0.0003145+input$gdat15*  -0.0005429 
                  + input$fb*-0.5025296+input$teamkills* 0.2768595+ input$teamdeaths* -0.2684347 
                  +input$ft*-1.7174641 +input$teamtowerkills*0.9032026 +input$opptowerkills*-0.9241948
                  +input$fd *0.3033756 +input$teamdragkills*0.1530605+input$oppdragkills*-0.1426903) ) })
  }
  shinyApp(ui, server)
}


我的界面是这样的:连文字都没有输出,interface

用这个替换你当前的UI。

根据@phalteman 对缺失输入的观察进行了更新。

ui <- fluidPage(
 numericInput("gdat10", "Gold difference at 10:00", ""),
 numericInput("gdat15", "Total gold earned at 15:00", ""),
 numericInput("fb", "First blood kill", ""),
 numericInput("teamkills", "Total kills by team", ""),
 numericInput("teamdeaths", "Total deaths by team", ""),
 numericInput("ft", "First tower of game killed", ""),
 numericInput("fd", "First dragon of game killed", ""),
 numericInput("teamdragkills", "Total dragons killed by team", ""),
 numericInput("oppdragkills", "Total dragons killed by opposing team", ""),
 numericInput("teamtowerkills", "Total tower killed by team", ""),
 numericInput("opptowerkills", "Total tower killed by opposing team", ""),
 textOutput('txtOutput')
)

您错过了 textOutput('txtOutput') 步骤。