I have a Rmd file with 3 sections, a, b and c. I can run everything up till the end of section b just fine with an output html document generated.
However, when I get to the section c I encounter memory issues. I am able to run this 3rd section on it's own.
So, I added a line before section c in my script starts with rm(list=ls())
. However, this doesn't solve the problem which is confusing since this section will run on it's own if there is no code beforehand.
I found a suggestion for .rs.restartR()
over here but presumably restarting R will interupt my Rmd file being rendered.
Is there a prescribed approach here?
Some older SO posts mention calling gc()
but that did not help.
If I can run sections a and b on their own and then section c on it's own, can I not somehow render the whole Rmd document, sections a through c by clearing memory before the code in section c runs?