I am working on r shiny interface , but I was blocked by some basic functions like renderText, I got nothing on my interface
I have serval methods: like textOutput and renderText alone but my last try is paste0, but sadly it didn't work.
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)
}
My interface is like this: no output even the text,interface
Replace your current UI with this.
Updated with @phalteman’s observation of missing inputs.
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')
)
You were missing the textOutput('txtOutput')
step.