【问题标题】:mainPanel argument missing in ui.r file using R's Shiny package使用 R 的 Shiny 包的 ui.r 文件中缺少 mainPanel 参数
【发布时间】:2014-10-03 06:08:18
【问题描述】:

我在 R 中运行 Shiny 来创建 GUI,我收到以下错误:ERROR: argument "mainPanel" is missing, with no default

但是,正如您在 ui.r 文件中的以下代码中看到的那样,我确实在底部包含了 mainPanel,它应该会成功传递给 sidebarLayout

require(shiny)

shinyUI(fluidPage(
titlePanel("Approach"),
sidebarLayout(
    sidebarPanel(
        fileInput('file1', 'Choose file to upload',
                accept = c(
                    'text/csv',
                    'text/comma-separated-values',
                    'text/tab-separated-values',
                    'text/plain',
                    '.csv',
                    '.tsv'
                )
        )

    )
),
    mainPanel(
        plotOutput("plot")
    )



)
)

我还确保在mainPanel 之前包含一个逗号,正如Error in RShiny ui.r argument missing 中所建议的那样

非常感谢任何建议。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    mainPanel 需要在 sidebarLayout 函数内调用。见?sidebarLayout

    require(shiny)
    
    shinyUI(fluidPage(
      titlePanel("Approach"),
      sidebarLayout(
        sidebarPanel(
          fileInput('file1', 'Choose file to upload',
                    accept = c(
                      'text/csv',
                      'text/comma-separated-values',
                      'text/tab-separated-values',
                      'text/plain',
                      '.csv',
                      '.tsv'
                    )
          )
    
        ),
        mainPanel(
          plotOutput("plot")
        )
      )
    )
    )
    

    【讨论】:

      猜你喜欢
      • 2021-03-10
      • 1970-01-01
      • 2019-02-15
      • 2016-06-08
      • 2020-06-14
      • 1970-01-01
      • 2020-07-13
      • 2019-09-09
      相关资源
      最近更新 更多