【问题标题】:ConditionalPanel doesn't support variables with dot in the name, any work around?ConditionalPanel 不支持名称中带有点的变量,有什么解决方法吗?
【发布时间】:2013-08-20 09:52:06
【问题描述】:

这样就可以了

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

  ),

但这不是

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

  ),

文档中的什么地方说不支持带点的名称?是否有任何解决方法,所以我不必更改我的变量名?

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    conditionalPanel 中,条件是一个Javascript 表达式。当您输入“input.test”时,您依赖的是 Javascript 的点表示法。

    您不必更改变量名称。有一个简单的解决方法,只需使用方括号表示法:input["tes.t"]

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

    会起作用的。

    【讨论】:

      猜你喜欢
      • 2011-03-12
      • 2016-12-16
      • 2015-12-28
      • 2011-09-11
      • 1970-01-01
      • 2016-04-11
      • 1970-01-01
      • 2021-12-04
      相关资源
      最近更新 更多