Have several chunks in one loop?

I begin to use R-markdown recently. However, my script is included in a giant loop which groups several other loops inside. To deconstruct my code I created several chunks which I have named.

Can we run several chunks in one and same loop, without having to put everything in one chunk?

If this is not possible, is it possible to save the chunks by name and then reuse them further and compile them into the loop that would be in a single chunk? Basically, compile several chunks into a loop that is in one chunk. I don't know if this is possible, hence my question here.

Thank for your help.

You should have a look at several advanced feature

knitr::knit_child() could be the function you are looking for. As suggest reading the doc and understanding the example to see what you could do.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.