2017-01-01 3 views
1

は私のコードです:Rタブパネルとここで出力

shinyServer <- function(input, output) { 

    output$text_out <- renderText({ 
     paste("You have selected", input$text_input) 
    }) 

    } 

shinyUI <- fluidPage(
    titlePanel("censusVis"), 
    fluidRow(
    column(3, textInput('text_input', label = 'some label', value ='')), 
    column(9, 
      tabsetPanel(
       tabPanel('result', 
          fluidRow(
          column(12, h3('Test_header'), 
            textOutput('text_out') 
          ) 
         ) 
       ), 
       tabPanel('some panel', tableOutput('table')), 
       tabPanel('another panel', tableOutput('table')) 

     ) 
    ) 
) 

) 
shinyApp(ui=shinyUI, server = shinyServer) 

それは動作しますが、私はその行"You have selected"が現れ、コードtabPanel('another panel', tableOutput('table'))に次の行をコメントする場合には、ライン"You have selected"を表示しません。何が間違っているのか知っていますか?なぜtabPanelが出力に影響しますか?

答えて

3

2つのtabPanelで同じ出力tableOutput('table')を2回使用します。それはなぜtext_outを示していないThats。 this-

shinyServer <- function(input, output) { 

    output$text_out <- renderText({ 
     paste("You have selected", input$text_input) 
    }) 

} 

shinyUI <- fluidPage(
    titlePanel("censusVis"), 
    fluidRow(
     column(width = 3, textInput('text_input', label = 'some label', value ='')), 
     column(width = 9, 
       tabsetPanel(
        tabPanel(title = 'result', 
          fluidRow(
           column(width = 12, 
             h3('Test_header'), 
             textOutput('text_out') 
           ) 
          ) 
        ), 
        tabPanel(title = 'some panel', 
          tableOutput('table1') 
        ), 
        tabPanel(title = 'another panel', 
          tableOutput('table2') 
        ) 
       ) 
     ) 
    ) 
) 
shinyApp(ui=shinyUI, server = shinyServer)