R 主面板中的可折叠输出

R 主面板中的可折叠输出,r,shiny,R,Shiny,我有一个有两个相关分析的闪亮应用程序。在每个分析中都有一些不同类型的结果 接口变得非常繁忙,我希望输出元素是可折叠的() 是否有此类ui文件的示例?我现在的一个看起来像这样: shinyUI( fluidPage( tabsetPanel( tabPanel("Analysis 1", sidebarPanel( sliderInput("value1", "some value",

我有一个有两个相关分析的闪亮应用程序。在每个分析中都有一些不同类型的结果

接口变得非常繁忙,我希望输出元素是可折叠的()

是否有此类
ui
文件的示例?我现在的一个看起来像这样:

shinyUI(
    fluidPage(
      tabsetPanel(
        tabPanel("Analysis 1",
                 sidebarPanel(
                   sliderInput("value1", "some value", 
                               min=1, max=20, value=5, step=0.2)
                 ), 
                 mainPanel(
                   ## these two elements collapse together
                   p(textOutput("results_1_a_text")), 
                   plotOutput("results_1_a_graph", height = "400px"),
                   ## these two elements collapse together
                   p(textOutput("results_1_b_text")), 
                   plotOutput("results_1_b_graph", height = "400px")
                 )
        ), 
        tabPanel("Analysis 2",
                 sidebarPanel(
                   sliderInput("value2", "some value", 
                               min=1, max=20, value=5, step=0.2)
                 ), 
                 mainPanel(
                   ## these two elements collapse together
                   p(textOutput("results_2_a_text")), 
                   plotOutput("results_2_a_graph", height = "400px"),
                   ## these two elements collapse together
                   p(textOutput("results_2_b_text")), 
                   plotOutput("results_2_b_graph", height = "400px")
                 )
        )
      )  
    )
  )
谢谢

Max

请看一下。从那里也可以得到例子

library(shiny)
library(shinyBS)

shinyApp(
  ui =
    fluidPage(
      sidebarLayout(
        sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."),
                     actionButton("p1Button", "Push Me!"),
                     selectInput("styleSelect", "Select style for Panel 1",
                                 c("default", "primary", "danger", "warning", "info", "success"))
        ),
        mainPanel(
          bsCollapse(id = "collapseExample", open = "Panel 2",
                     bsCollapsePanel("Panel 1", "This is a panel with just text ",
                                     "and has the default style. You can change the style in ",
                                     "the sidebar.", style = "info"),
                     bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
                                     "and a 'success' style.", plotOutput("genericPlot"), style = "success")
          )
        )
      )
    ),
  server =
    function(input, output, session) {
      output$genericPlot <- renderPlot(plot(rnorm(100)))
      observeEvent(input$p1Button, ({
        updateCollapse(session, "collapseExample", open = "Panel 1")
      }))
      observeEvent(input$styleSelect, ({
        updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
      }))
    }
)
库(闪亮)
图书馆(shinyBS)
shinyApp(
用户界面=
流动摄影(
侧边栏布局(
侧边栏面板(HTML(“此按钮将使用updateCollapse打开面板1”),
动作按钮(“p1Button”,“推我!”),
选择输入(“样式选择”,“为面板1选择样式”,
c(“默认”、“主要”、“危险”、“警告”、“信息”、“成功”))
),
主面板(
b折叠(id=“collapseExample”,open=“Panel 2”,
bCollapsePanel(“面板1”,“这是一个只有文本的面板”,
“并具有默认样式。您可以在中更改样式”,
“侧边栏”,style=“info”),
bCollapsePanel(“面板2”,“此面板具有通用绘图。”,
“和‘成功’样式。”,plotOutput(“genericPlot”),style=“success”)
)
)
)
),
服务器=
功能(输入、输出、会话){
output$genericPlot也可以看一下这个例子

library(shiny)
library(shinyBS)

shinyApp(
  ui =
    fluidPage(
      sidebarLayout(
        sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."),
                     actionButton("p1Button", "Push Me!"),
                     selectInput("styleSelect", "Select style for Panel 1",
                                 c("default", "primary", "danger", "warning", "info", "success"))
        ),
        mainPanel(
          bsCollapse(id = "collapseExample", open = "Panel 2",
                     bsCollapsePanel("Panel 1", "This is a panel with just text ",
                                     "and has the default style. You can change the style in ",
                                     "the sidebar.", style = "info"),
                     bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
                                     "and a 'success' style.", plotOutput("genericPlot"), style = "success")
          )
        )
      )
    ),
  server =
    function(input, output, session) {
      output$genericPlot <- renderPlot(plot(rnorm(100)))
      observeEvent(input$p1Button, ({
        updateCollapse(session, "collapseExample", open = "Panel 1")
      }))
      observeEvent(input$styleSelect, ({
        updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
      }))
    }
)
库(闪亮)
图书馆(shinyBS)
shinyApp(
用户界面=
流动摄影(
侧边栏布局(
侧边栏面板(HTML(“此按钮将使用updateCollapse打开面板1”),
动作按钮(“p1Button”,“推我!”),
选择输入(“样式选择”,“为面板1选择样式”,
c(“默认”、“主要”、“危险”、“警告”、“信息”、“成功”))
),
主面板(
b折叠(id=“collapseExample”,open=“Panel 2”,
bCollapsePanel(“面板1”,“这是一个只有文本的面板”,
“并具有默认样式。您可以在中更改样式”,
“侧边栏”,style=“info”),
bCollapsePanel(“面板2”,“此面板具有通用绘图。”,
“和‘成功’样式。”,plotOutput(“genericPlot”),style=“success”)
)
)
)
),
服务器=
功能(输入、输出、会话){

output$genericPlot你所说的可折叠是什么意思?这个例子我不清楚。为什么不使用shinydashboard,因为它在Lonel中构建了此功能-显示了一个折叠内容的示例。我希望能够折叠一系列结果(例如文本、绘图等)这是由服务器文件.pops生成的-我现在正在看这个,但似乎有点过头了。另外,我必须完全重写ui文件。我希望有更简洁的东西。好的,看看ShinyBS,那么你说的可折叠是什么意思?我不清楚这个例子。为什么不使用shinydashboard,因为它有这个特性e Build inColonel-显示了一个折叠内容的示例。我希望能够折叠一系列结果(例如文本、绘图等)这是由服务器文件.pops生成的-我现在正在查看它,但似乎有点过头了。另外,我必须完全重写ui文件。我希望有更简洁的内容。好吧,那就看一看ShinyBS吧