Rmarkdown preview is very slow

I used R markdown to create a html notebook (actually r notebook). By adding pictures without other coding processes, at first it ran fluently, but when I put more and more it appears that when I pressed preview which basically generate file nb.html, the Rstudio process very slow. The size of my note book is 13.2 MB. Does anyone know how to fix this ?

It makes sense that it would take longer if you're adding more images. I'm not sure how much detail you'll get, given that there's not code inside of your document, but you could try running profvis around rmarkdown::render().

profvis::profvis ({

Thanks mara,

I just tried to present my results in a html form. It makes sense that when I have more images it take more time.
After my tring,Not ony preview is very slow. When I opened that project, even type enter on console, it take more time to just go next line.

Once you have your hard-to-produce output finalized, save them, instead of generating them anew each time. Save your images to a images folder in your path, save large data objects in a data folder.

Yes. You can do this by setting various cache options either globally or by individual code chunks. (The first link below will bring you to the specific section on code chunk options).

For more detailed info on cache options:

1 Like