【问题标题】:Render Greek letters in table ouput of shiny apps在闪亮应用的表格输出中渲染希腊字母
【发布时间】:2015-10-29 22:59:33
【问题描述】:

我的闪亮用户!我无法在我的 Shiny 表输出中呈现希腊字母。请注意,我确实知道如何使用 HTML 函数在 Shiny 中打印希腊字母。参见下面的代码 sn-ps。

这是 ui.R:

library(shiny)

shinyUI(pageWithSidebar(

  headerPanel("A sample"),

  sidebarPanel(
    numericInput(
      inputId = "alpha",
      label = HTML("α:"),
      value = 0.05,
      step = 0.01
    )
  ),

  mainPanel(
    plotOutput("samplePlot")
  )
))

这是 server.R:

shinyServer(function(input, output) {
  output$samplePlot <- renderPlot({
    hist(c(1:100), main = "A Sample Plot", xlab = "Whatever")
  })
})

这很好用,并在滑块中给了我一个希腊字母。但是,我也希望在我的表格输出中包含希腊字母,但类似的方法似乎不起作用......请参阅下面的代码。

这是 ui.R:

library(shiny)

shinyUI(pageWithSidebar(

  headerPanel("A sample"),

  sidebarPanel(
    numericInput(
      inputId = "alpha",
      label = HTML("&alpha;:"),
      value = 0.05,
      step = 0.01
    )
  ),

  mainPanel(
    plotOutput("samplePlot"),
    tableOutput("myTable")
  )
))

这是 server.R:

shinyServer(function(input, output) {
  output$samplePlot <- renderPlot({
    hist(c(1:100), main = "A Sample Plot", xlab = "Whatever")
  })

  output$myTable <- renderTable({
    data.frame(alpha = HTML("&alpha;:"), value = 3)
  })
})

关于如何在表格输出的 alpha 列中打印出希腊字母的任何想法。感谢任何帮助!

【问题讨论】:

    标签: html r shiny


    【解决方案1】:

    试试

    sanitize.text.function = function(x) x
    

    作为 renderTable 的一个选项,

    我从这篇文章中得到的想法:

    r shiny table not rendering html

    【讨论】:

      猜你喜欢
      • 2022-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-14
      • 1970-01-01
      • 2019-10-03
      • 2016-06-12
      • 2016-03-04
      相关资源
      最近更新 更多