2017-12-27 9 views
0

샤이니 어플의 mainPaneltabsetPanel을 여러 개 포함하려고합니다. 앱을 실행하면 앱이 서버 요소에 전혀 빠져들지 않고 UI 요소를 파악하려고하는 것처럼 보이지 않습니다.반짝 이는 여러 탭셋에 반응하지 않습니다

왜 그런지 누구나 알고 있습니까?

다음은 RStudio의 Shiny app 템플릿을 기반으로 한 최소 예제입니다.

ui.R

library(shiny) 

# Define UI for application that draws a histogram 
shinyUI(fluidPage(

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
    sidebarPanel(
     sliderInput("bins", 
        "Number of bins:", 
        min = 1, 
        max = 50, 
        value = 30) 
    ), 

    # Multiple tabset panels 
    mainPanel(
     h2("tabsetpanel1"), 
     tabsetPanel(id = "pan1", 
        type = "tabs", 
        tabPanel("tab1", plotOutput("distPlot"))), 
     h2("tabsetpanel2"), 
     tabsetPanel(id = "pan2", 
        type = "tabs", 
        tabPanel("tab2", plotOutput("distPlot"))) 
    ) 
) 
)) 

server.R

귀하의 출력, 당신 캔트 여러 "distPlot"이 고유 이런 일을 변경해야
library(shiny) 

# Define server logic required to draw a histogram 
shinyServer(function(input, output) { 

    output$distPlot <- renderPlot({ 

    # generate bins based on input$bins from ui.R 
    x <- faithful[, 2] 
    bins <- seq(min(x), max(x), length.out = input$bins + 1) 

    # draw the histogram with the specified number of bins 
    hist(x, breaks = bins, col = 'darkgray', border = 'white') 

    }) 

}) 

답변

0

:

data <- reactive({ 
    # generate bins based on input$bins from ui.R 
    x <- faithful[, 2] 
    bins <- seq(min(x), max(x), length.out = input$bins + 1) 

    # draw the histogram with the specified number of bins 
    hist(x, breaks = bins, col = 'darkgray', border = 'white') 
}) 

    output$distPlot1 <- renderPlot({ 
    data() 
    }) 

    output$distPlot2 <- renderPlot({ 
    data() 
    }) 

다음 내 주소록 ui

plotOutput("distPlot1") 

plotOutput("distPlot2")