I have this html knit output from Rmarkdown but since it is pretty heavy (it is an online guide), the page takes too long to show up when opening the link. I tried to divide the
Investigate and try to reduce the size of yours pictures/graphics : in parallel or alternatively to the 'split' of your text in several 'html-pages', the idea is to made a compromise between time of opening and quality of your graphics (and imported pictures).
So, try :
Why reduce the size of your pictures and graphics in your document ? If images are render in ultra high def, it's resulting in a very huge size for the exported document that contain a bunch of images, and lot of time for reading file in memory (openning), memory crash or freeze, etc. So, sizes (def) of images in a document are frequently the key for reducing the weight of a document, and maybe you'll have to search in the 'image or graphic' part of the code for these 2 cases :
1- If you indicate size of an image in Rmarkdown at the very beginning of your image-codechunk, check that 'fig.height' & 'fig.width' indicates a reasonnable size, like the following :
```{r name_of_the_chunk, fig.cap="Name_of_fig", fig.height=10, fig.width=8}
2- the same case than previously is maybe present or necessary in some code that saved the graph or render the image or whatever, so ensure that you indicate for reasonable dimensions ('width' and 'height') in your 'programmatic' way to render the image, if the codechunk don't indicate a size, i.e :
svg("my.svg", width = 8,height =8)
[code of your graph]
maybe height and width are set in ggsave(file="myfile.svg",device = "svg",width =6,height = 6,units = "cm")
[code of your graph]
... or whatever function you use for generate your pictures.
Alternatively, you could use a graphic library for resizing every images before to knit your document (i.e : ImageMagick).
Excellent day
Probably the best way to speed things up is to break up your web site into multiple pages. You can use the blogdown
package to support this, but for a first try, it's even easier to use an RStudio site generator. Here are the steps:
Create a new RStudio project; choose "Simple R Markdown website" for the type of project. This automatically creates three files, _site.yml
, about.Rmd
, index.Rmd
.
Decide how you want to break up the files into separate pages, and create .Rmd
files for each one. The headers should be similar to the ones in about.Rmd
and index.Rmd
, and you
should add lines to _site.yml
for each page.
Click on "Build website" in the Build pane (usually top right in RStudio). This will process all of the files and open the website at the index page.
The HTML files will be stored in the _site
folder within your project; you can copy them from there to your web server.