如何解决创建仪表板时,出现“tagAssert(body, type = "div", class = "content-wrapper") 中的错误:缺少参数“body”,没有默认值”
我正在学习使用 Shiny 仪表板创建仪表板。我收到上述错误。 我的代码如下:
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader( title="Minh a,try your best to be yourself"),dashboardSidebar(
sidebarMenu(
menuItem(text="i can do it",tabName='i can do it',icon('alicorn')),menuItem("this is what I can do",tabName = 'list',icon = icon('list'))
),dashboardBody(
tabItems(
tabItem(tabName = 'i can do it'),tabItem(tabName='data',dataTableOutput('mydatatable'))
)
)
)
)
serve <- function (input,output){
output$mydatatable <- renderDataTable({msci})
}
shinyApp(ui,serve)
解决方法
在启动dashboardSidebar
之前,您需要关闭dashboardBody
函数。试试这个:
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader( title="Minh a,try your best to be yourself"),dashboardSidebar(
sidebarMenu(
menuItem(text="i can do it",tabName='i can do it',icon('alicorn')),menuItem("this is what I can do",tabName = 'list',icon = icon('list'))
)),dashboardBody(
tabItems(
tabItem(tabName = 'i can do it'),tabItem(tabName='data',dataTableOutput('mydatatable'))
)
)
)
server <- function (input,output){
output$mydatatable <- renderDataTable({msci})
}
shinyApp(ui,server)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。