![](/img/trans.png)
[英]How to add text formatting like superscript or subscript to a label in a Shiny app?
[英]How to add subscript or superscript to renderText in R shiny
有没有办法将 html 文本格式(例如上标或下标)添加到renderText()
的 output 中。 html
标签似乎在这种情况下不起作用。
最小的例子:
library(shiny)
ui <- fluidPage(
titlePanel("Subscript test"),
mainPanel(textOutput("test"))
)
server <- function(input, output) {
output$test <- renderText("CO<sub>2</sub>")
}
shinyApp(ui = ui, server = server)
您的代码只需textOutput()
ui
部分中的 textOutput() 更改为htmlOutput()
。 后者 function 专门设计用于返回一个反应变量为 HTML output,它允许使用 Z4CZDBAD5FCA2E78A1C7ED 等。
更多信息在这里: https://shiny.rstudio.com/reference/shiny/0.11.1/htmlOutput.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.