更新:我在这里发布了一个相关问题
我需要使用 includeHTML 在闪亮中包含一个 html 文件。该文件由rmarkdown生成,有大量的htmlWidget。
Shiny 正在显示 html 文件,但缺少 htmlWidgests。仅当 includeHTML 在 server.R 中时才会出现此问题,但如果 includeHTLM 在 ui.R 中则可以正常工作。我需要更新 file.html,因此 includeHTML 必须在反应式上下文中使用。
file.rmd 是这样的
---
title: "test"
author: "me"
date: '`r Sys.Date()`'
output: html_document
---
```{r}
df<- data.frame(a = c(1:10), b = c(1:10))
rpivotTable::rpivotTable(df , rows = 'a' , cols= 'b' )
rpivotTable::rpivotTable(df , rows = 'a' , cols= 'b' )
rpivotTable::rpivotTable(df , rows = 'a' , cols= 'b' )
```
然后渲染到 file.html
rmarkdown::render( input = 'file.RMD' )
这个闪亮的应用程序还可以
ui <- shinyUI(
fluidPage(
includeHTML('file.html')
)
)
server <- function(input, output) { }
shinyApp(ui, server)
但是这个不起作用。
ui <- shinyUI(
fluidPage(
uiOutput('tables')
)
)
server <- shinyServer(function(input, output) {
output$tables <- shiny::renderUI(
includeHTML('file.html')
)
})
shinyApp(ui, server)