output $ loc2 <-renderInfoBox({:找不到对象'输出'

时间:2019-01-08 13:15:46

标签: r shiny

我想在ShinyApp中渲染信息框。 我在以下代码上收到错误“ output $ loc2 <-renderInfoBox({:object'output'not found”“

library(shiny)
library(shinydashboard)
library(dplyr)
ui <- shinyUI(fluidPage(
  mainPanel(width = "1260px", 
        tabsetPanel(type = "tab",
                    tabPanel(h5("Labtest"), 
                             fluidRow(
                               radioButtons("Ben2", "Details:", 
c("Hypertension", "RBS", "HB", "Malaria"), inline = T),
                               infoBoxOutput("loc2", width = 960)))))))
server <- shinyServer(
output$loc2 <- renderInfoBox({
if(input$Ben2 == "Hypertension") {
box(width='100%', h3("Hypertension"),
infoBox(100, "Total", icon = icon('heartbeat'), width = 3, color = 
"orange", fill = T))          
} else{if(input$Ben2 == "RBS"){
infoBox(30, "Normal",  "Cummulative", icon = icon('heartbeat'), 
width = 3, color = "green", fill = T)
}
else {if(input$Ben2 == "HB"){
infoBox(30, "Pre-Hypertension", "Cummulative", icon = icon('heartbeat'), 
width = 3, color = "yellow", fill = T)
} else{
infoBox(40, "Hypertension", "Cummulative", icon = icon('heartbeat'), width = 
3, color = "red", fill = T)
}}
}}    
))

shinyApp(ui, server)

有人可以帮助我解决此错误吗?

谢谢。

2 个答案:

答案 0 :(得分:0)

服务器<-函数(输入,输出,会话){而不是ShinyServer(

答案 1 :(得分:0)

现在,逻辑在关闭并重新运行后可以正常工作。