Reputation: 6659
I am using the R shiny app and creating a table using renderTable and tableOutput. Is it possible to make one part of a cells contents bold whilst keeping the rest of it normal text.
E.g. one entry in a particular cell could be:
5.3% ~ 1% ~ 7
I tried hardcoding ** around the appropriate figure but it just outputted the asterisk.
Thanks
Upvotes: 3
Views: 4122
Reputation: 21443
You can use the <strong></strong>
HTML tag in your table if you want some bold text, here's an example:
library(shiny)
data<-data.frame(a=c("<strong>a</strong>","b"),val=c(1,2))
runApp(list(
ui = basicPage(
tableOutput('mytable')
),
server = function(input, output) {
output$mytable = renderTable({
data
},sanitize.text.function=function(x){x})
}
))
You need to change the sanitize.text.function
to identity in order for the tags to be interpreted.
As an alternative, you can also use Datatables to render your table. You can also use the <strong>
tag, but make sure you set the escape
option to false in the renderDataTable
part.
Upvotes: 6