UPDATE: I posted a related question here
I need to include an html file in shiny using includeHTML. The file is generated by rmarkdown, and has a large number of htmlWidgets.
Shiny is showing the html file, but the htmlWidgests are missing. The problem occurs only when includeHTML is in server.R, but works ok if includeHTLM is in ui.R. I need to update file.html so includeHTML must be used in a reactive context.
The file.rmd is somthing like this
---
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' )
```
then render to file.html
rmarkdown::render( input = 'file.RMD' )
This shiny app is OK
ui <- shinyUI(
fluidPage(
includeHTML('file.html')
)
)
server <- function(input, output) { }
shinyApp(ui, server)
BUT this one does not work.
ui <- shinyUI(
fluidPage(
uiOutput('tables')
)
)
server <- shinyServer(function(input, output) {
output$tables <- shiny::renderUI(
includeHTML('file.html')
)
})
shinyApp(ui, server)