如何在闪亮表头中使用符号?

桃花鱼

目标:在Shiny App的列标题中使用数学符号。

例如,x-bar或beta,alpha等。

下面是我尝试过的结果,它会产生奇怪的结果(参见图片)。

我也尝试使用和表达式,这给出了这个错误: Warning: Error in as.data.frame.default: cannot coerce class ""expression"" to a data.frame

ui.R文件:

library(shiny)

shinyUI(pageWithSidebar(
  headerPanel("Hello Shiny!"),
  sidebarPanel(),
  mainPanel(
    tableOutput("mytable"),
    tableOutput("mytable2")
  )
))

server.R文件:

library(shiny)

shinyServer(function(input, output) {

  mytable <- reactive({
    iris2 <- iris
    colnames(iris2) <-  c("Sepal.Length", "Sepal.Width","$m^r_t$", "$\\delta p_t$","$R^r_t$")
  })

  output$mytable <-  renderTable(head(iris,5))
  output$mytable2 <-  renderTable(mytable())

})

输出: 在此处输入图片说明

桃花鱼

答案是依靠html使用比R更复杂的表头的Unicode字符:

  output$mytable2 <-  renderTable({mytable()},include.colnames=FALSE,
                                  add.to.row = list(pos = list(0), 
                                  command = " <tr> <th> &#931 </th> <th> &#963;</th> <th> &#7839;</th> <th> &#127137;</th> <th>  &#x263A; </th>  </tr>" ))

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在matplotlib中使用unicode符号?

如何在AVAudioEngine的水龙头中使用AVAudioNodeTapBlock。

如何在符号中使用lastIndexOf()函数

如何在请求的标头中使用Swashbuckle设置多个api键

如何使用JavaFX在表头中适当调整自定义控件的大小?

如何在ArcGis中使用gif符号

在Red中发出POST请求时如何在标头中使用变量

如何在element-ui(vue.js)中的表头中添加工具提示?

如何在C中使用√符号

如何在MVC的jQuery中使用@符号

C ++-通过宏定义的名称空间-如何在标头中使用它

如何通过闪亮模块在DataTable中使用闪亮动作按钮?

Unity AR Foundation(iOS):如何在前置摄像头中使用人体跟踪

如何在Flutter中使用http包在标头中发送参数

如何在Vuetify中将工具提示添加到数据表头中?

如何在节点获取标头中使用嵌套的对象/数组符号?

如何在闪亮的仪表板中使用多个slickROutput

Bootstrap 3如何在表头中间制作“ aaaaa”?

如何在Ubuntu中使用数学符号?

SSRS使用表头中的功能

如何在表头中使用可调整大小的 jquery 以及如何在调整表头大小时扩展父 div?

如何在 Retrofit 标头中使用本机字符串?

如何在 Postman 示例响应头中使用变量

如何在http响应头中使用特殊字符

如何分离json数据的键并在表头中使用它[javascript或PHP]

如何在单选按钮选项中使用 html r 闪亮

如何在闪亮的应用程序中使用 renv 包以避免在闪亮的服务器上安装新包?

如何在yaml中使用$(美元符号)^(指数符号)?

在表头中使用 flex 的正确方法是什么?