Display HTML file in Shiny App

霸气de小男生 提交于 2019-11-27 03:21:14

问题


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 tabular output in HTML file.

Html file contains tabele as given below:

Any help will be highly appreciated.

Thanks! Tinku

@MrFlick - Thanks for your email. fluidPage is not working. It's giving the error message that:

ERROR: could not find function "fluidPage"

titlePanel is also not working.

Note - When I used pageWithSidebar instaed of fluidPage and headerPanel instead of titlePanel then it's workinmg fine.


回答1:


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.



来源:https://stackoverflow.com/questions/24875943/display-html-file-in-shiny-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!