【发布时间】:2021-07-22 22:30:01
【问题描述】:
我正在构建一个闪亮的应用程序,当我点击运行应用程序时,我收到如下错误:
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",width=3),
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,solidHeader = TRUE, collapsible = TRUE,
plotlyOutput("plot2",height=250)),
box(title = "Pressure curve", width = 4,solidHeader = TRUE, collapsible = TRUE,
plotlyOutput("plot3",height=250)),
)
),
))
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, aes(x=Test_Time_sec, y=Baro_Temp_C))+
geom_line(size = 1.2,color="blue")
)
})
output$plot3 = renderPlotly({
ggplotly(ggplot(df1, aes(x=Test_Time_sec, 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, format = "f"),'Thrust (in N)',color = "aqua")})
output$value3 <- renderValueBox({valueBox(formatC(Pressurevalue, format = "f"),'Thrust (in N)',color = "aqua")})
}
shinyApp(ui = ui, server = server)
【问题讨论】:
标签: r shiny plotly-dash shinydashboard shinyapps