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".
Is this possible?
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!
As follows:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With