Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ConditionalPanel doesn't support variables with dot in the name, any work around?

Tags:

r

shiny

This would work

  checkboxInput("test", "test", TRUE),
  conditionalPanel(
    condition="input.test",
    h2("test test")

  ),

but this not

  checkboxInput("tes.t", "tes.t", TRUE),
  conditionalPanel(
    condition="input.tes.t",
    h2("tes.t tes.t")

  ),

Where in the document does it say the name with dots are not supported? Are there any work around so I don't have to change my variable names?

like image 514
colinfang Avatar asked Aug 20 '13 09:08

colinfang


1 Answers

In conditionalPanel the condition is a Javascript expression. You are relying on Javascript's dot notation when you type "input.test".

You don't have to change your variable names. There is a simple workaround, just use the square bracket notation instead: input["tes.t"]

 checkboxInput("tes.t", label="tes.t", TRUE),
    conditionalPanel(
      condition='input["tes.t"]',
      h2("tes.t tes.t")

will work.

like image 128
Ram Narasimhan Avatar answered Oct 14 '22 23:10

Ram Narasimhan