tagAssert(body,type =“ div”,class =“ content-wrapper”)中的错误:参数“ body”丢失,没有默认值

时间:2018-10-15 04:48:06

标签: r shiny

我无法确定我在编码中到底做错了什么。 出现错误: tagAssert(正文,类型=“ div”,类=“ content-wrapper”)中的错误:   缺少参数“ body”,没有默认值

library(shiny)
library(shinydashboard)
library(ECharts2Shiny)
dat1 <- data.frame(c(75,68,80,528),
               c(40,33,30,100),
               c(50,38,54,98),
               c(25,30,30,430))
names(dat1) <- c("Visitors", "Referred", "Male", "Female")
row.names(dat1) <- c("Baksa", "Barpeta","Biswanath","Bongaigaon")

ui <- shinyUI(
dashboardPage(dashboardHeader(title = "Sanj"),
            dashboardSidebar(sidebarMenu(menuItem("ABC", tabName = "Sanj", 
                                        menuSubItem("Baksa"), 
                                        menuSubItem("Barpeta"), 
                                        menuSubItem("Biswanath"), 
                                        menuSubItem("Bongaigaon")))),
dashboardBody(fluidPage(h1("Sanj"),
mainPanel(tabsetPanel(type = "tab",
tabPanel(h5("Visitors vs. Referred"),
loadEChartsLibrary(), tags$div(id="test1", 
style="width:150%;height:500px;"),
deliverChart(div_id = "test1")))))

server <- shinyServer(function(input,output){
renderBarChart(div_id = "test1", grid_left = '1%', direction = "vertical",
             data = dat1)})

shinyApp(ui, server)

1 个答案:

答案 0 :(得分:1)

一切正常,您只是忘记了括号:

library(shiny)
library(shinydashboard)
library(ECharts2Shiny)

dat1 <- data.frame(c(75,68,80,528),
                   c(40,33,30,100),
                   c(50,38,54,98),
                   c(25,30,30,430))
names(dat1) <- c("Visitors", "Referred", "Male", "Female")
row.names(dat1) <- c("Baksa", "Barpeta","Biswanath","Bongaigaon")

ui <- shinyUI(
  dashboardPage(dashboardHeader(title = "Sanj"),
                dashboardSidebar(sidebarMenu(menuItem("ABC", tabName = "Sanj", 
                                                      menuSubItem("Baksa"), 
                                                      menuSubItem("Barpeta"), 
                                                      menuSubItem("Biswanath"), 
                                                      menuSubItem("Bongaigaon")))),
                dashboardBody(fluidPage(h1("Sanj"),
                                        mainPanel(tabsetPanel(type = "tab",
                                                              tabPanel(h5("Visitors vs. Referred"),
                                                                       loadEChartsLibrary(), 
                                                                       tags$div(id="test1",style="width:150%;height:500px;"),
                                                                       deliverChart(div_id = "test1")))))
                )))




server <- shinyServer(function(input,output){
  renderBarChart(div_id = "test1", grid_left = '1%', direction = "vertical",
                 data = dat1)})

shinyApp(ui, server)

enter image description here