2017-11-25 138 views
0

這是我的第一個Shiny App,作爲我的Coursera Data Science專業化的一部分。我正在嘗試爲文檔創建一個Tab,但主標籤的輸出顯示在MainApp選項卡和文檔中。Shiny App在多個標籤中顯示輸出

我不想輸出在「文檔」選項卡

任何幫助嗎?謝謝!

這是ui.R代碼:

shinyUI(
    pageWithSidebar(
    headerPanel (" Six Sigma Control Charts"), 



     tabsetPanel(


     tabPanel("MainApp", 
       sidebarPanel(
        h5 ("Control Charts are six sigma tools that track process statistics over time to detect the presence of special causes of variation. There are different types of charts according to the data type that you are analysing."), 

        selectInput("DataType", "Please select Data Type", 
           choices = c("Continuous", "Attribute")), 
        conditionalPanel(condition = "input.DataType == 'Continuous'", 
            selectInput("Groups", "Data collected in groups?", 
               choices = c("Yes", "No"))), 
        conditionalPanel(condition = "input.DataType == 'Attribute'", 
            selectInput("Counting", "What are you counting?", 
               choices = c("Defective items", "Defects per unit"))), 


        conditionalPanel(condition = "input.Groups == 'Yes' & input.DataType == 'Continuous' ", 
            textInput ("SubgroupSize", "Enter sub group size",1) ) 


       )), 

     tabPanel("Documentation", 

       h5 ("This Shiny App helps you to familiarise with Six Sigma Control Charts."), 
       h5 ("The different types of graphs are produced according to the type of data that you want to analyse"), 
       h5 ("Make a choice according to the data type to explore the various Six Sigma graphs") 
     ) 





    ), 



    mainPanel (

      plotOutput ("ControlChart"), 
      textOutput("Explanation"), 
      br(100), 
      br() 


    ) 


) 

) 

回答

0

這是不可能的pageWithSidebar功能。無論如何這個函數都被棄用了。嘗試將fluidPage換成navbarPage

# Define UI 
ui <- navbarPage("App Title", 
       tabPanel("Plot", 
          fluidPage(
          sidebarLayout(

           # Sidebar with a slider input 
           sidebarPanel(
           sliderInput("obs", 
              "Number of observations:", 
              min = 0, 
              max = 1000, 
              value = 500) 
          ), 

           # Show a plot of the generated distribution 
           mainPanel(
           plotOutput("distPlot") 
          ) 
          ) 
         ) 

       ), 
       tabPanel("Summary", 
          tags$br("Some text")) 
) 

# Server logic 
server <- function(input, output) { 
    output$distPlot <- renderPlot({ 
    hist(rnorm(input$obs)) 
    }) 
} 

# Complete app with UI and server components 
shinyApp(ui, server) 
+0

非常感謝!我現在可以完成我的任務。 –