【问题标题】:Including tabset panel in sidebarPanel of shiny在闪亮的 sidebarPanel 中包含选项卡集面板
【发布时间】:2014-01-21 01:31:27
【问题描述】:

我正在使用闪亮的包来创建一个应用程序。我想在我的侧边栏面板中包含一个选项卡集面板,就像 tabsetPanel() 为用户界面中的 mainPanel() 所做的那样。有谁知道这是否或如何工作?

提前致谢!

【问题讨论】:

    标签: r tabs panel sidebar shiny


    【解决方案1】:

    mainPanelsidebarPanel 只是 div 标记的包装,这是一种 html 容器,您可以在其中放置任何其他 html 有效元素。

    例如,您可以这样做:

    library(shiny)
    ui <- pageWithSidebar(
      # Application title
      headerPanel("Hello Shiny!"),
      # Sidebar with a slider input
      sidebarPanel(
        tabsetPanel(
          tabPanel("Plot", plotOutput("plot")),
          tabPanel("Summary", verbatimTextOutput("summary")),
          tabPanel("Table", tableOutput("table"))
        )),
      # Show a plot of the generated distribution
      mainPanel(
        plotOutput("distPlot")
      )
    )
    
    server <- function(input,output){}
    
    runApp(list(ui=ui,server=server))
    

    【讨论】:

    • 这正常工作正常,但在选择TabPanel“plot”时,闪亮会如何打印绘图,而不是给出“摘要”和“表”。我添加了 tabsetPanel(id="tabname",...) 并在 mainPanel(...) 中选择了一个 conditionalPanel(...) 但它仍然一次提供所有输出。
    猜你喜欢
    • 1970-01-01
    • 2015-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-22
    • 2021-04-06
    • 2016-12-20
    • 1970-01-01
    相关资源
    最近更新 更多