在表中渲染子/上标(闪亮) [英] Render sub/superscript in table (shiny)

查看:48
本文介绍了在表中渲染子/上标(闪亮)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个闪亮的应用程序中有一个数据表,我想在其中添加上标到我的观察中.这些应该详细说明观察是否是估计值,以及观察年份与参考年份的距离(此数据已在我的数据集中).例如,一个特定的观察可能会显示:75(上标)-3 e".

I have a datatable in a shiny app, in which I want to add superscript to my observations. These should detail whether the observation is an estimate, and how far the year of the observation is from the reference year (this data is already in my dataset). For example a particular observation might display : "75(superscript)-3 e".

这可能吗?

推荐答案

我今天遇到了同样的问题,这篇文章帮助我了解了一些方法.有一个工作示例如何在 renderTable (Shiny) 的行名中添加下标? 我已经粘贴在下面,并完全承认它不是我的!

I had the same question today and this post helped me get some of the way there. There is a working example of this on How to add subscripts in the row names of a renderTable (Shiny)? which I have pasted below, with the full acknowledgement that it's not mine!

如下:

  library(shiny)
  library(DT)
  ui <- fluidPage(dataTableOutput("table"))

  server <- function(input, output) {
     output$table <- renderDataTable({
      data <- datatable(data.frame(c(1, 2), row.names = c("A<sub>1</sub>", "A<sub>2</sub>")), rownames = T, escape = FALSE)
      })
  }

  shinyApp(ui = ui, server = server)

我在表的主体中尝试过类似的 标签,它以相同的方式处理它.

I have tried similar <sub> and <sup> tags in the body of the table and it treats it in the same way.

这篇关于在表中渲染子/上标(闪亮)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆