如何解决force 中的错误ui:未找到对象“ui”和 TagAssert 中的错误
我正在构建一个闪亮的应用程序,当我点击运行应用程序时,我收到如下错误:
tagAssert(body,type = "div",class = "content-wrapper") 中的错误: 需要一个类为“shiny.tag”的对象。
当我单击 Ctrl+Enter 时。这是错误 力错误(ui):找不到对象“ui”
rm(list=ls())
## app.R ##
library(shiny)
library(shinydashboard)
library(shinydashboardplus)
library(ggplot2)
library(plotly)
library(caTools)
library(caret)
library(Hmisc)
library(data.table)
library(DT)
library(reshape2)
#Estes E9-4
setwd("E:/akshaya/courses/STAR Space/Internship/Team work/Dashboard")
df1 = read.csv("Motor Test Data.csv",stringsAsFactors = F)
View(df1)
# RShiny dashboard
header = dashboardHeader(title = "Solid Motor Test Results")
sidebar = dashboardSidebar(sidebarMenu(id = "tabs",menuItem("Dashboard",tabName = "Summary",icon = icon("dashboard")),menuItem("Daywise",tabName = "Daywise",icon = icon("chart-line")),#to get input for a particular tab use conditional panel
conditionalPanel(
"input.tabs == 'Daywise'",#country selection
selectInput(inputId = "Date",label = "Select Date :",choices = unique(df1$Date_o_fTest),multiple = T)
),menuItem("Simmulation Summary",tabName = "Model",icon = icon("chart-bar")),menuItem("Visit-us",icon = icon("send",lib='glyphicon'),href = "https://www.starlabsurat.com/")
)
)
body = dashboardBody(
tabItems(
# second tab content
tabItem(tabName = "Daywise",h2("Test Day for the Day"),fluidRow(valueBoxOutput("value1",width=3),valueBoxOutput("value2",valueBoxOutput("value3",width=3)),),# third tab content
tabItem(tabName = "Model",h2("Simulation Summary"),fluidRow(
Box(title = "Thrust Curve",width = 8,solidHeader = TRUE,collapsible = TRUE,plotlyOutput("plot1",height=250)),fluidRow(
Box(title = "Temperature Curve",width = 4,plotlyOutput("plot2",Box(title = "Pressure curve",plotlyOutput("plot3",)
),))
ui = dashboardPage(header,sidebar,body)
server = function(input,output,session) {
#for Simulation Summary
output$plot1 = renderPlotly({
ggplotly(ggplot(df1,aes(x=Test_Time_sec,y=Load_Cell_N))+
geom_line(size = 1.2,color="red")
)
})
output$plot2 = renderPlotly({
ggplotly(ggplot(df1,y=Baro_Temp_C))+
geom_line(size = 1.2,color="blue")
)
})
output$plot3 = renderPlotly({
ggplotly(ggplot(df1,y=Baro_Pressure_hpa))+
geom_line(size = 1.2,color="green")
)
})
#for Day wise tab
dfsub <- reactive({
filter(df1,Date_of_Test %in% input$Date)
})
# for dashboard view
Loadvalue <- dfsub[5]
Tempvalue <- dfsub[6]
Pressurevalue <- dfsub[7]
output$value1 <- renderValueBox({valueBox(formatC(Loadvalue,format = "f"),'Thrust (in N)',color = "aqua")})
output$value2 <- renderValueBox({valueBox(formatC(Tempvalue,color = "aqua")})
output$value3 <- renderValueBox({valueBox(formatC(Pressurevalue,color = "aqua")})
}
shinyApp(ui = ui,server = server)
解决方法
您的 tabItems
中有一个尾随逗号,您必须将其删除。
# third tab content
tabItem(tabName = "Model",h2("Simulation Summary"),fluidRow(
box(title = "Thrust Curve",width = 8,solidHeader = TRUE,collapsible = TRUE,plotlyOutput("plot1",height=250)),),fluidRow(
box(title = "Temperature Curve",width = 4,plotlyOutput("plot2",box(title = "Pressure curve",plotlyOutput("plot3",)
),#### <-- REMOVE THIS COMMA
))
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。