I have a piece of text that uses the Greek letter delta, and I want the text to be formatted with HTML in my Shiny app. Using unicode, this does not render correctly. However, doing this the same way but in a ggplot's title, it renders correctly.
How can I fix this?
Minimal Reprex:
library(shiny)
library(ggplot2)
ui <- fluidPage(
htmlOutput("mytxt_WithHTML"), #Render the HTML text
plotOutput("myplot", height="200px", width="500px")) #render plot
server <- function(input, output, session) {
output$mytxt_WithHTML <- renderText({
mytxt <- paste0("<b><center>Within renderText, the Greek letter delta appears as:", "\u03b4", "</center></b>")#Can add "<br>" for line break
mytxt
})
output$myplot <- renderPlot({
ggplot(mtcars, aes(x=mpg, y=cyl)) + geom_point() + ggtitle("Within a ggplot title, the Greek letter delta appears as: \u03b4")
})
}
shinyApp(ui, server)