一次只显示一个Shiny中的一个Tabset面板

时间:2016-07-22 11:45:54

标签: r shiny

我想知道显示不同的Tabset面板。我有一些示例代码,我尝试使其工作,但它一次显示所有三个Tabset面板,但是,我想一次只显示一个。

一些示例代码:

ui.r

filenames <- list.files(path = "data",pattern="\\.txt$")
names(filenames) <- gsub(pattern = "\\.txt$", "", filenames)
shinyUI(fluidPage(theme = "bootstrap.css",
                  (navbarPage("BETA Version",position = c("fixed-top"), fluid=TRUE,  ##position = c("fixed-top"), fluid=TRUE
                              navbarMenu("Help",

                                         tabPanel(
                                           a("List of GPLs available",
                                             target="_blank",href="GPLs.pdf")),

                                         tabPanel(
                                           a("Reference Manual",
                                             target="_blank", href="UserGuide.pdf")))
                  )),

                  br(),
                  titlePanel( 
                    headerPanel( 
                      h3("Hello Hello Testing", align="center", style="bold"))),

                  br(),
                  br(),

                  sidebarLayout(
                    sidebarPanel(
                      h5("Upload Data Files",style="bold"),
                      fileInput("files", "Choose CSV/txt processed files or raw files", multiple = "TRUE",
                                accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv','.cel','.TXT','.txt')),

                      #selectInput('dataset',"Choose platform annotation file", c("Please select a file" ='',filenames)),

                      fluidRow(
                        column(10,
                               radioButtons("radiometa", label = h5("What you want"),
                                            choices = list(" Control)" = 1, 
                                                           "PCA" = 2, "analysis" = 3),selected = NULL))),
                      conditionalPanel(
                        "input.radiometa == 1",
                        wellPanel(
                          h5("Symbol File ", style = "bold"),
                          fileInput("file1", "Choose  files", multiple = "FALSE",
                                    accept=c('text/csv', 'text/comma-separated-values,
                                             text/plain', '.csv','.cel','.TXT','.txt')),
                          h5("Calculation", style = "bold"),
                          fileInput("file2", "Choose  files", multiple = "FALSE",
                                    accept=c('text/csv', 'text/comma-separated-values,
                                             text/plain', '.csv','.cel','.TXT','.txt')),
                          radioButtons("radioQC1", label = h5("Settings"), 
                                       choices = list("Default setting" = 1, "Parameter Setting" = 2)),

                          conditionalPanel(
                            "input.radioQC1 == 2",
                            h5("Set Parameters"),
                            checkboxInput("checkboxQC1", label= "P Processing", value = FALSE),
                            checkboxInput("checkboxQC2", label= "Cache", value = FALSE),
                            checkboxInput("checkboxQC3", label= " Genes", value = FALSE),
                            numericInput("numQC0", label = h5("Number of C"),
                                         value = NULL, min = 2, max = 8, step = 1),
                            numericInput("numQC1", label = h5("Allowed"),
                                         value = NULL, min = 0.1, max = 2, step = 0.1),
                            numericInput("numQC2", label = h5(" Mean"),
                                         value = NULL, min = 0.1, max = 2, step = 0.1),
                            numericInput("numQC3", label = h5("Cut Ration"),
                                         value = NULL, min = 0.1, max = 2, step = 0.1),
                            numericInput("numQC4", label = h5("Min number"),
                                         value = NULL, min = 1, max = 10, step = 1),
                            radioButtons("radioQC2", label = h5("Data"), 
                                         choices = list("Twocl" = "Two", "Multicl" = "Multi", 
                                                        "Surv" = "Sur")),
                            textInput("textQC1", label = "Tests", value = "E.g 1e2 or 1e3 or 1e4 .."),
                            numericInput("textQC2", label = "PCut", value = NULL, 
                                         min = 0.01, max = 1, step = 0.01),
                            checkboxInput("checkboxQC4", label= "Adjust ", value = FALSE)
                          )
                          )
                        ),

                      conditionalPanel(
                        "input.radiometa == 2",
                        wellPanel(
                          h5("PCA ", style = "bold"),
                          radioButtons("PCAMethods", label = h5("Choose PCA method"),
                                       choices = list("An" = 1, "Ei" = 2,
                                                      "Rob" = 3, "Spar" = 4), selected = NULL),

                          conditionalPanel(
                            "input.PCAMethods == 3",
                            radioButtons("PCARobMethod", label = h5("Choose PCA Variance"),
                                         choices = list("qn" = 1, "mad" = 2), selected = NULL)

                          ),
                          numericInput("NumofPC", label = h5("Choose Num of PC"),
                                       value = NULL, min = 1, max = 5, step = 1),

                          numericInput("MaxItertions", label = h5("Maximum Iterations"),
                                       value = NULL, min = 1, max = 200, step = 1),
                          textInput("SprsEps", label = h5("Presion Level"), value = "E.g 1e-3"),
                          checkboxInput("Scale", label= h5("Normalization"), value = FALSE),
                          checkboxInput("ScaleAdjus", label= h5("Scaling Adjustment"), value = FALSE),
                          checkboxInput("GeneFilt", label= h5("Filtering"), value = FALSE),
                          numericInput("CutRatioByMean", label = h5("By Mean"),
                                       value = NULL, min = .1, max = 1, step = .1),
                          numericInput("CutRatioByVar", label = h5("By Variance"),
                                       value = NULL, min = .1, max = 1, step = .1),
                          checkboxInput("ImputeMissing", label= h5(" Genes"),
                                        value = FALSE),
                          numericInput("StdyWisGenfilt", label =
                                         h5("missing proportio"),
                                       value = NULL, min = .1, max = 1, step = .1),
                          numericInput("EachstdyGenfilt", label = 
                                         h5("Filter proportion"),
                                       value = NULL, min = .1, max = 1, step = .1)

                        )

                      ),

                      conditionalPanel(
                        "input.radiometa == 3",
                        wellPanel(
                          h5("Upload Data Files",style="bold"),
                          selectInput('dataset',"file", c("Please select a file" ='',filenames)),
                          radioButtons("radio", label = h5("Data uploaded"),
                                       choices = list("Affy" = 1, "Ill" = 3),selected = NULL),
                          radioButtons("radio1", label = h5("Choose a method"),
                                       choices = list(
                                         "Fill" = 1, "Stap" = 2,
                                         "Astg" = 3, "ming" = 4,
                                         "malti" = 5, "SR" = 6,
                                         "PRsgs" = 7,"mi" = 8,
                                         "ma" = 9,
                                         "Fist" = 10,
                                         "Stng" = 11),
                                       selected = NULL)
                        )
                      ),


                      br(),



                      column(5,
                             actionButton("Submit", label = "Submit")),

                      br(),
                      br(),

                      br()

                       ),


                    mainPanel(
                      conditionalPanel(
                        condition = "input.radiometa == 1",
                        tabsetPanel(
                          tabPanel("Sample Data",dataTableOutput("qfile")),
                          tabPanel("Source Data", dataTableOutput("sourced")),
                          tabPanel("Q Summary",dataTableOutput("qSummary")),
                          tabPanel("Plot", plotOutput("PlotSummary"))
                        )
                      ),

                      conditionalPanel(
                        condition = "input.radiometa ==2",
                        tabsetPanel(
                          tabPanel("Panel1",dataTableOutput("panel1")),
                          tabPanel("Panel2", dataTableOutput("panel2"))
                        )
                      ),

                      conditionalPanel(
                        condition = "input.radiometa == 3",
                        tabsetPanel(
                          tabPanel("File List",dataTableOutput("file")),
                          tabPanel("Source Data", dataTableOutput("sourced")),
                          tabPanel("Annotation Data",dataTableOutput("annotation")),
                          tabPanel("Summary",dataTableOutput("final")),
                          tabPanel("Supplementary File", dataTableOutput("full"))
                        )
                      )
                    )
                      )
                    ))

server.r

shinyServer(function(input, output) {
})

1 个答案:

答案 0 :(得分:1)

问题是因为您在第一个和第三个Source Data中有tabPaneltabsetPanel的重复名称。纠正这个,不应该给任何问题。希望这有效。