我什么都没有作为renderText的输出

时间:2019-03-26 22:06:39

标签: r shiny

我正在使用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

1 个答案:

答案 0 :(得分:0)

以此替换当前的用户界面。

通过@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')
)