【问题标题】:Argument is missing, with no default缺少参数,没有默认值
【发布时间】:2019-06-07 13:39:23
【问题描述】:

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

"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')),

      )))))

【问题讨论】:

  • rpivotTableOutput("pivot4", width = '100%', height = '300px'))之后去掉逗号
  • 哇.....我想很容易忽略简单的事情。非常感谢。
  • 如果您想省去输入一些 br()s:lapply(rep('', 6), br) 或使用 css 边距。

标签: r shiny


【解决方案1】:
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')))))

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

【讨论】:

    【解决方案2】:

    我遇到了和你一样的问题,感谢@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",
                     
            )
        
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 2016-06-08
      • 2017-12-09
      • 2020-07-04
      相关资源
      最近更新 更多