Execute Chunks Under Header or Between Line Numbers

I have a markdown document that is 5K lines long with many code chunks. I have specific code chunks in the middle of the document that I'd like to run. For example

One

Chunk one

print("chunk one")

Chunk two

print("chunk two")

Two

Chunk three

print("chunk three")

Chunk four

print("chunk four")

Three

Chunk five

print("chunk five")

Is there a way to execute just the chunks under the header #Two, or even chunks between the line X:Y that contain the chunks under the header #Two? I've tried hacking some things together with rstudioapi::executeCommand("executeNextChunk") but that did not go smoothly.

Any advice would be greatly appreciated.

This topic was automatically closed 21 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.