我希望有一个带有选项卡的侧边栏面板,同时它还具有一个共享元素,如果您单击选项卡,该元素不会更改。
直观地讲,如果将侧边栏面板分成两部分,上面的部分具有tabsetPanel,共享元素的底部,则可以实现此目的,但是我找不到任何允许这样做的东西。 (例如pageWithSidebar ( headerPanel(), sidebarPanel(tabsetPanel()),sidebarPanel(),mainPanel())
这可能吗?
例如这使我有两个彼此相邻的侧边栏,并且在第二个下方有一个主面板:
library(shiny)
ui <- fluidPage(
sidebarPanel(
tabsetPanel(
tabPanel("analysis-settings1",
textInput("settings1",label = "set some options")),
tabPanel("analysis-settings2",
textInput("settings2",label = "Some other settings"))
)),
sidebarPanel(
actionButton(inputId = "go", label="Go"),
verbatimTextOutput("showsummarysettings")),
mainPanel("..")
)
server <- function(input, output) {
observeEvent(input$go, ignoreInit=TRUE, {
output$showsummarysettings <- renderText({
"analysis-settings1 include ... and analysis-settings2 include ..."
})
})
}
# Run the app ----
shinyApp(ui = ui, server = server)
答案 0 :(得分:1)
如果这不能解决您的问题,请告诉我
library(shiny)
ui <- fluidPage(
sidebarPanel(
tabsetPanel(
tabPanel("analysis-settings1",
textInput("settings1",label = "set some options")),
tabPanel("analysis-settings2",
textInput("settings2",label = "Some other settings"))
),
actionButton(inputId = "go", label="Go"),
verbatimTextOutput("showsummarysettings")),
mainPanel("..")
)
server <- function(input, output) {
observeEvent(input$go, ignoreInit=TRUE, {
output$showsummarysettings <- renderText({
"analysis-settings1 include ... and analysis-settings2 include ..."
})
})
}
# Run the app ----
shinyApp(ui = ui, server = server)