闪亮的UI:在radioButton和checkboxGroupInput中的`withMathJax()`

时间:2016-05-30 11:01:49

标签: r shiny

Shiny提供withMathJax()功能以在UI中显示公式。

我想显示一些数学wihtin复选框和/或radiobutton选项 - 但不要让它工作。

最小的例子

require(shiny)
runApp(
  list(ui = pageWithSidebar(

    headerPanel(withMathJax("$$\\text{Here it works }X_n=X_{n-1}-\\varepsilon$$")),

    sidebarPanel( radioButtons("test", withMathJax("$$\\text{Here it works too }X_n=X_{n-1}$$"),
                               choices = c(paste(withMathJax("$$\\text{Here it doesn`t work }X_n=X_{n-1}$$"), "= test"),
                                           "Rohe Skalierung"        = "raw",
                                           "Ueber alle Werte"        = "std",
                                           "Innerhalb der Personen" = "gstd"))),

    mainPanel( )
  ),
  server= function(input, output, session){

  }
  )
)

1 个答案:

答案 0 :(得分:0)

试验和错误,受corresponding RStudio shiny gallery example启发,引出了以下解决方案:

require(shiny)
runApp(
  list(ui = pageWithSidebar(

    headerPanel(withMathJax("$$\\text{Here it works }X_n=X_{n-1}-\\varepsilon$$")),

    sidebarPanel(withMathJax(), radioButtons("test",  "\\(X_n=X_{n-1}\\)",
                               choices = c("\\(X_n= \\text{And Here it works to }X_{n-1}\\)"      = "test",
                                           "Rohe Skalierung"         = "raw",
                                           "Ueber alle Werte"        = "std",
                                           "Innerhalb der Personen"  = "gstd"))),

    mainPanel( )
  ),
  server= function(input, output, session){

  }
  )
)