如何在闪亮的应用程序

时间:2018-05-31 17:01:59

标签: shiny

我想在侧栏“otu selection”和“anova”中有两个标签。 根据侧栏中选择的选项卡,我想在主面板中输出不同的图表或表格。

目前我收到错误:

ERROR: object 'input.tabs' not found

这是我的剧本。

ui <- fluidPage(
  # Make a title to display in the app
  titlePanel(" Exploring the Effect of Metarhizium on the Soil and Root Microbiome "),
  # Make the Sidebar layout
  sidebarLayout(
    # Put in the sidebar all the input functions
    sidebarPanel(
      tabsetPanel(id="tabs",
        tabPanel("otu","OTU selection", selectInput('dataset', 'dataset', names(abundance_tables)),
                 uiOutput("otu"), br(),
                 # Add comment
                 p("For details on OTU identification please refer to the original publications")),
        tabPanel("anova","anova", sliderInput('pval','p-value for significance',
                                      value=5,min=0,max=0.5,step=0.00001),
                 selectInput('fact_ofInt','factor of interest',FactorsOfInt))
        )
    ),
    # Put in the main panel of the layout the output functions 
    mainPanel(
      conditionalPanel(condition=input.tabs == 'otu',
        plotOutput('plot')
     #   dataTableOutput("table")
      ),
     conditionalPanel(condition=input.tabs == 'anova',
                      plotOutput('plot2')
                      #   dataTableOutput("table")
     )
    )
  )
)

我看了类似的帖子,但仍需要一些指导。

由于

1 个答案:

答案 0 :(得分:2)

您的条件面板条件以错误的格式声明。 正确的格式是

 # Put in the main panel of the layout the output functions 
    mainPanel(
      conditionalPanel(condition=input.tabs == 'otu',
        plotOutput('plot')
     #   dataTableOutput("table")
      ),
     conditionalPanel(condition="input.tabs == 'anova'",
                      plotOutput('plot2')
                      #   dataTableOutput("table")
     )
    )

因此条件总是在&#34;&#34;中分配,并在&#34;&#34;中分配。执行相等检查。

相关问题