2

有人可以帮我解决以下闪亮的问题:我需要制作一个条件面板,但在这里我不希望它出现,除非有人选择女性。但是,当我运行此代码时,条件面板会出现在页面中。任何帮助都感激不尽 ...

selectInput("gender", 
            "What is your gender?", 
            choices = c(Male="Male", Female="Female")),
conditionalPanel(condition = "input.gender=='Female'", 
                 selectInput("cond_sel",  
                             "Are you pregnant?", 
                             c("Yes", "No"))))
4

1 回答 1

1

尝试

selectInput("gender", 
            "What is your gender?", 
            choices = c(Male="Male", Female="Female"),selected='Male'),
conditionalPanel(condition = "input.gender=='Female'", 
                 selectInput("cond_sel",  
                             "Are you pregnant?", 
                             c("Yes", "No"),selected='No')))
于 2014-05-23T18:07:03.823 回答