Hi everyone,
I am including Plotly graphs in my Shiny app in several ways directly but I also want to include them as part of Rmds because they are easy to maintain and update.
In the Rmd and resulting html file the plots work fine but when I include them in the server part of my app the plots do not show up while every other part of the rmd/html file works fine.
Here is a minimal working example:
load <-
c("shiny",
"markdown",
"rmarkdown",
"DT",
"knitr",
"kableExtra",
"RODBC",
"tidyr",
"tidyverse",
"ggplot2",
"RMySQL",
"stringr",
"plotly",
"shinycssloaders"
)
lapply(load, require, character.only = TRUE)
ui <- navbarPage("Testapp",
tabPanel("Welcome",
tabPanel("Test 1",
uiOutput("page_mkt_1") %>%
withSpinner(color="#0dc5c1")
)
)
)
server <- function(input, output, session) {
output$page_mkt_1 <- renderUI({
p <- includeHTML("www/06_marketing.html")
HTML(paste(htmltools::tagList(list(p))))
})
}
shinyApp(ui = ui, server = server)
To reproduce just write a short rmd file with a Plotly graph and knit it to html.
Thanks for the help!