簡體   English   中英

在Shiny App中顯示HTML文件

[英]Display HTML file in Shiny App

是否可以在Shiny app中顯示html文件(在主面板中)? 此HTML由SAS代碼創建,但我想在Shiny App中顯示。 這不是一個小圖像。 這是HTML文件中的表格輸出。

Html文件包含tabele,如下所示:

在此輸入圖像描述

任何幫助將受到高度贊賞。

謝謝! Tinku

@MrFlick - 感謝您的電子郵件。 fluidPage無法正常工作。 它給出了以下錯誤消息:

ERROR: could not find function "fluidPage"

titlePanel也無法正常工作。

注意 - 當我使用pageWithSidebar instaed的fluidPage和headerPanel而不是titlePanel時,它的工作正常。

如果要在布局中包含來自其他文件的HTML內容,只需使用includeHTML()函數。 例如

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

對於特定頁面上“include.html”的內容應該是最低限度的。 如果你需要讓它更具動感,你可以做到

#  ----- 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()})
})

您可以使用您想要的任何邏輯來指定要加載的文件名。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM