I have a dataframe of the following form:
myDf <- data.frame(doc = c(1, 2, 3), text = c("Statement 1: ok<br/> Statement 2: not ok",
"Statement 1: true\n Statement 2: false", "Statement 1: yes Statement 2: no"))
Which I would like to render as the following in a shiny
app:
doc text
1 1 Statement 1: ok
Statement 2: not ok
2 2 Statement 1: true
Statement 2: false
3 3 Statement 1: yes Statement 2: no
However, each time I try (either using br
or \n
) the text is rendered verbatim.
Code for Shiny app:
library(shiny)
server <- function(input, output) {
myDf <- data.frame(doc = c(1, 2, 3), text = c("Statement 1: ok<br/> Statement 2: not ok", "Statement 1: true\n Statement 2: false", "Statement 1: yes Statement 2: no"))
output$dfTable <- renderTable({ myDf })
}
ui <- fluidPage(
mainPanel(tableOutput("dfTable"))
)
shinyApp(ui = ui, server = server)
I have found one webpage that mentions this issue, but discusses it more in the context of rmarkdown
and mustache
.
Another discusses this in context of Latex
.