繁体   English   中英

缺少参数,没有默认值

[英]Argument is missing, with no default

我一直无法找到下面发布的代码中缺少的内容。 我不断收到以下错误:

“tabsetPanel 中的错误(id = “tracker”,tabPanel(“Premium”,tags$head(tags$style(type = “text/css”,:参数丢失,没有默认值)

ui <- dashboardPage(skin = "green",
  dashboardHeader(title="Niche Tool"),
  dashboardSidebar(disable = TRUE),
  dashboardBody(
tags$style(HTML(".box-header{background:#d2d2d2; color:#d83000; text-align:center;}")),

shinyUI <- fluidPage(
  mainPanel(
    tabsetPanel(
      id = 'tracker',
      tabPanel("Premium", 
               tags$head(tags$style( type = 'text/css',  '#myPivot{ overflow-x: scroll; overflow-y: scroll; }')),
               rpivotTableOutput("pivot1", width = '100%', height = '300px'), br(), br(), br(), br(),br(), br(),
               rpivotTableOutput("pivot2", width = '100%', height = '300px')),
      #tabPanel("Incurred Losses"),
      tabPanel("Discretionary Pricing",
               rpivotTableOutput("pivot3", width = '100%', height = '300px'), br(), br(), br(), br(),br(), br(),
               rpivotTableOutput("pivot4", width = '100%', height = '300px')),

      )))))
ui <- dashboardPage(skin = "green",
                    dashboardHeader(title="Niche Tool"),
                    dashboardSidebar(disable = TRUE),
                    dashboardBody(
                      tags$style(HTML(".box-header{background:#d2d2d2; color:#d83000; text-align:center;}")),

                      shinyUI <- fluidPage(
                        mainPanel(
                          tabsetPanel(
                            tabPanel("Premium", 
                                     tags$head(tags$style( type = 'text/css',  '#myPivot{ overflow-x: scroll; overflow-y: scroll; }')),
                                     rpivotTableOutput("pivot1", width = '100%', height = '300px'), br(), br(), br(), br(),br(), br(),
                                     rpivotTableOutput("pivot2", width = '100%', height = '300px')),
                            #tabPanel("Incurred Losses"),
                            tabPanel("Discretionary Pricing",
                                     rpivotTableOutput("pivot3", width = '100%', height = '300px'), br(), br(), br(), br(),br(), br(),
                                     rpivotTableOutput("pivot4", width = '100%', height = '300px')),id = 'tracker')))))

我无法重现该示例,因为我没有代码的服务器部分,但试试这个

我遇到了和你一样的问题,感谢@ismirsehregal 我可以解决它。 以防万一有人想看到一个完整和“简单”的例子,这里是一个不起作用的例子。

library(shiny)

ui <- fluidPage(
  
  titlePanel("App"),
  
  sidebarLayout(
    sidebarPanel(
      tabsetPanel(
        
        tabPanel("Tab1",
                 
        ),
        
        tabPanel("Tab2",
                 
        ),
        
        tabPanel("Tab3",
                 
        ),
        
        
        tabPanel("Tab4",
                 
        ),
        
      ),
      
      hr(),
      actionButton(inputId = "drawplot", label = "Show the plot")
      
    ),
    
    mainPanel(
      tableOutput("table")
      
    )
  ))
  
  
  library(shiny)
  
  server <- function(input, output, session) {
    
    output$table <- renderTable({mtcars})
  }
  

shinyApp(ui=ui, server=server)

我收到此错误:

Warning: Error in tabsetPanel: argument is missing, with no default

解决方案是从最后一个 TabPanel 中删除最后一个逗号。

tabPanel("Tab4",
                 
        )
    

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM