如何在Shining中将server.R解析为HTML标记

如何在Shining中将server.R解析为HTML标记,r,shiny,R,Shiny,我要做的是解析从server.R的反应函数返回的HTML字符串。我已经尝试了好几天来解决这个问题,但没有运气。例如,给定以下ui.R文件: library(shiny) shinyUI(pageWithSidebar( headerPanel("Code"), sidebarPanel( ), mainPanel( textOutput("code") ) )) shinyServer(function(input, output) { outp

我要做的是解析从server.R的反应函数返回的HTML字符串。我已经尝试了好几天来解决这个问题,但没有运气。例如,给定以下ui.R文件:

library(shiny)
shinyUI(pageWithSidebar( 
  headerPanel("Code"), 
  sidebarPanel(   
  ), 
  mainPanel(
    textOutput("code")
  )  
))
shinyServer(function(input, output) {
  output$code <- renderText({   
    HTML('<strong> Hello World <strong>')
  }) 
})
server.R文件:

library(shiny)
shinyUI(pageWithSidebar( 
  headerPanel("Code"), 
  sidebarPanel(   
  ), 
  mainPanel(
    textOutput("code")
  )  
))
shinyServer(function(input, output) {
  output$code <- renderText({   
    HTML('<strong> Hello World <strong>')
  }) 
})
shinyServer(功能(输入、输出){

output$codeAll,多亏StackOverflow的善良灵魂,我找到了解决方案。您只需使用renderUI和uiOutput即可:

服务器.R

shinyServer(function(input, output) {
  output$code <- renderUI({   
    HTML('<strong> Hello World <strong>')
  }) 
})

问题已解决。

您可以使用
uiOutput
renderUI
而不是有效的文本,谢谢!您是救世主!我将作为答案发布给其他人看。