Hello. I have a RMarkdown flex-dashboard document that is nearly 20MB in size. It has 7 tabs (business category) that is made up of several grid and subplots. Unfortunately, clicking between the tabs (the first time) takes upwards of 10-15 seconds to render.
A two part question:
Is it possible to cache the plots (plotly objects) so they render faster? I believe this is most the bottleneck.
Is it possible to break the documents up and link the separate documents together to lessen the overall size.
I have heard that I might be able to accomplish #2 with child documents, but have not found much information on this,
I think you would need to go to a shiny app approach (with or without using flexdashboard) and yes you'll be able to cache plot
Yes you can still use static website (no server processing, so no shiny app), but separate you big dashboard in several file in order for them to load not all at once (like now I suppose) but only when the page is click on. You could generate several html file (using parametrized dashboard or other mechanism), then have an index.html page, (which could be a flexdashboard) that linked to all these page. The load in the browser would be less.
Also, have you thought about deactivating the self_contained = TRUE option in flexdashboard ? with this activated, everything is encoded to be put inside one html. Using FALSE, you will have a html file AND a folder with ressource. This would lead to smaller html, loading from files what is required. It could improve the response by the browser.
Thank you for the reply. I truly appreciate it. These are actually options that I have thought of. To this:
If I do cache, how can I expire the cache at the end of the day? I have been unable to determine how to do so, possibly based on max(date) column on a dataframe being changed....?
If I break the document up, would this be considered "child documents" or just documents linked on the index.Rmd page? I have heard a little about child documents, but have found little info on what they are and how to do it.
Regarding the self_contained setting. Is it correct that this setting is specific to HTML documents; output of HTML in YAML? Our Rmd is a FlexDashboard.
If you develop your website as a shiny application, you will have a server with R running code, and you can invalidate with any mechanism you want I think. There is already a function to cache plot
I am not sure if you mean that, but child document is sometime used with R markdown about the code source to be in several document. One main Rmd and some child, to be merged together at rendering time. For html static website, this is not the same. I would break the site in several html and link that using html code and js in a main page. There is also the rmarkdown website option
Flexdashboard also have a self_contained option. They are based on the same kind of document as html_document. It is the template and them that changes. There is a self_contained argument. You can also insert shiny app element