更新:我发布了一个相关的问题here
我需要包括一个html文件在shiny使用includeHTML。该文件由rmarkdown生成,并且具有大量的htmlWidgets。
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)发布于 2016-08-25 19:26:43
我只是有机会深入研究这个问题,我得到的错误是来自这些lines的window.buildTabsets()。
在YAML中修复
如果我使用这些yaml选项来禁用bootstrap,我会得到预期的结果,但会丢失bootstrap。
---
title: "test"
author: "me"
date: '`r Sys.Date()`'
output:
html_document:
theme: null
mathjax: null
---确认?
如果可能,请您验证一下这是否也适用于您这一方?
更好的方法?
一般来说,我会推荐一种不同的方法,因为呈现的html将包含所有依赖项,并且将是一个通过websocket传递的非常大的文件。也许,这个issue可以帮助描述一种潜在的更好的方法。
https://stackoverflow.com/questions/39024390
复制相似问题