Display HTML file in Shiny App

后端 未结 1 412
-上瘾入骨i
-上瘾入骨i 2020-12-05 18:40

Is it possible to display a html file in Shiny app (in main panel)? This HTML is created by a SAS code but I want to display in Shiny App. This is not a small image. This is

相关标签:
1条回答
  • 2020-12-05 18:55

    If you want to include HTML content from another file in a layout, just use the includeHTML() function. For example

    shinyUI(fluidPage(
      titlePanel("Included Content"),
      mainPanel(
        includeHTML("include.html")
      )
    ))
    

    should be minimally sufficient to how the contents of "include.html" on a particular page. If you need to make it more dynamic, you can do

    #  ----- ui.R -----
    
    shinyUI(fluidPage(
      titlePanel("Uploading Files"),
      mainPanel(
        htmlOutput("inc")
      )
    ))
    
    #  ----- server.R -----
    
    shinyServer(function(input, output) {
      getPage<-function() {
          return(includeHTML("include.html"))
      }
      output$inc<-renderUI({getPage()})
    })
    

    And you could use whatever logic you want to to specify the filename you want to load.

    0 讨论(0)
提交回复
热议问题