这不是一个解决方案,而是一个后续@ easports611评论。下面是一个应用程序,其中的答案不工作:
server <- function(input, output, session) {
library(data.table)
data("iris")
output$buySegments <- DT::renderDataTable({
colnames(iris)=c("a <br>b","c<br>d","e<br>f","g<br>h","i")
sketch<-htmltools::withTags(table(
tableHeader(iris
)))
#rangeRatio
thing = DT::datatable(
iris
,rownames = FALSE
,container = sketch
)
return(thing)
}
)
}
ui=shinyUI(
fluidPage(theme = "bootstrap.css",title = "Buyer Console",
mainPanel(
DT::dataTableOutput('buySegments')
)
)
)
shinyApp(ui = ui, server = server)
问题显然是,我通过一个容器指定的列名的事实。事实证明,解决方法是在tableHeader函数中设置escape=F
选项。
这不适合我。仍然没有换行符。 – Paul
你可以创建一个可重复使用的版本吗? – easports611
你是对的,对于隐晦的评论感到抱歉...我可以并将回来一个例子 – Paul