R Shiny includeHTML missing htmlWidgets en un contexto reactivo
ACTUALIZACIÓN: publiqué una pregunta relacionadaaquí
Necesito incluir un archivo html en shiny usando includeHTML. El archivo es generado por rmarkdown y tiene una gran cantidad de htmlWidgets.
Shiny muestra el archivo html, pero faltan los htmlWidgests. El problema ocurre solo cuando includeHTML está en server.R, pero funciona bien si includeHTLM está en ui.R. Necesito actualizar file.html, por lo que includeHTML debe usarse en un contexto reactivo.
El archivo.rmd es algo así
---
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' )
```
luego renderizar a file.html
rmarkdown::render( input = 'file.RMD' )
Esta aplicación brillante está bien
ui <- shinyUI(
fluidPage(
includeHTML('file.html')
)
)
server <- function(input, output) { }
shinyApp(ui, server)
PERO este no funciona.
ui <- shinyUI(
fluidPage(
uiOutput('tables')
)
)
server <- shinyServer(function(input, output) {
output$tables <- shiny::renderUI(
includeHTML('file.html')
)
})
shinyApp(ui, server)