Shiny 闪亮的阿尔帕内尔总是出现

Shiny 闪亮的阿尔帕内尔总是出现,shiny,Shiny,我使用一个现成的条件面板构建了一个小应用程序 第二次尝试不太令人满意。问题是,无论条件是否满足,条件面板都会出现 以下是我的精简版: library(shiny) source('distplot.r') ui<-fluidPage( fluidRow( radioButtons("intype", 'Data or Statistics?', c(Data="d", Statistics="s")), #Only show this if sample

我使用一个现成的条件面板构建了一个小应用程序

第二次尝试不太令人满意。问题是,无论条件是否满足,条件面板都会出现

以下是我的精简版:

 library(shiny)
 source('distplot.r')
 ui<-fluidPage(
 fluidRow(

 radioButtons("intype", 'Data or Statistics?',
         c(Data="d", Statistics="s")),

 #Only show this if sample data are to be entered     
 conditionalPanel(
    condition = "input$intype == 'd'",
      textInput('x', 'Sample Data (Comma Separated)', value='')),

#Only shows this panel for summary statitics (sd or sigma if known)
conditionalPanel(
    condition = "input$intype == 'r'",
        numericInput('m','Sample Mean',value=''),
        numericInput('sd','SD (Population or Sample)',value=''),
        numericInput('n','Sample size',value=''))
          )
             )       

 server<-function(input, output){

     DTYPE<-eventReactive(input$go,{input$dtype})
     output$plot<-renderPlot({hist(runif(1000))})
                        }
shinyApp(ui=ui, server=server)
库(闪亮)
源('distplot.r')

ui您需要在您的条件下使用
input.intype
而不是
input$intype
。此外,在您的示例中,
intype
只能是
'd'
's'
,并且在您的条件下使用
'r'

来自<代码>?Shining::conditionalPanel
的详细信息部分:

在JS表达式中,可以引用包含当前输入和输出值的输入和输出JavaScript对象。例如,如果您有一个id为foo的输入,则可以使用input.foo读取其值。(请确保不要修改输入/输出对象,因为这可能会导致不可预测的行为。)