첨부 된 MWE Shiny 예제에서 navbar 용 tabPanel 내에 중첩 tabsetPanel이 있습니다. TabSet 내에서 하나의 tabPanel 만 사용하여 MWE를 실행하면 Shiny가 예상대로 정확하게 작동하는 것을 확인할 수 있습니다. 그러나 두 tabPanels을 사용하여 MWE를 실행하면 각 탭의 기본 패널에 결과가 인쇄되지 않습니다.R Shiny : 중첩 tabPanels가 서로를 비활성화합니다.
왜이 문제가 발생합니까? 그리고 어떻게이 수수께끼를 해결할 수 있습니까?
library(shiny)
ui <- shinyUI(navbarPage("tabalicious",
tabPanel("Nav1", value = "nav1",
mainPanel(h2("Hello"),
br(),
p("This is my app.")
)
)
,
tabPanel("Nav2", value = "nav2",
tabsetPanel(
tabPanel("tabsettab1",
sidebarLayout(
sidebarPanel(
helpText("Choose your settings"),
selectInput("zone_type",
label = "Choose a zone type to display",
choices = list("Industrial", "Residential"),
selected = "Industrial")
),
mainPanel(h2("A tab for a tabSet"),
textOutput('zone_type')
)
)
)
# Uncomment this to see the issue
# ,
# tabPanel("tabsettab2",
# sidebarLayout(
# sidebarPanel(
# helpText("Choose your settings"),
# selectInput("zone_type",
# label = "Choose a zone type to display",
# choices = list("Industrial", "Residential"),
# selected = "Industrial")
# ),
# mainPanel(h2("A tab for a tabSet"),
# textOutput('zone_type')
# )
# )
#)
)
)
)
)
server <- shinyServer(function(input, output) {
output$zone_type <- renderText({
paste("You have selected", input$zone_type)
})
})
# Run the application
shinyApp(ui = ui, server = server)
그것은 탭에 대해 아니다, 그것은 약 2'shinyUI' 처리 할 수없는'같은'zone_type' 변수를 렌더링 호출 textOutput'을합니다. 필요한 경우 서버 함수의 다른 이름으로'output $ zone_type'을 복사 할 수 있습니다. – alistaire
답변으로 추가하십시오. –