Simone Marini Simone Marini - 10 months ago 64
R Question

RMarkdown code evaluation until command

I'm using RMarkdown where I'm building my analysis. The final output will be an html document. Actually I've got a core code which will be the final document and, after the end, I've got many lines of code with chunks and sentences that at the moment are not useful, but could be included in the final document.

    Does a command exist to say to RMarkdown to evaluate the code until that point?

Not just like
for chunks (I've got also plain text), but something like
in TeX. I don't want just to comment plain text and put
as chunks options.

I tried to google and read in the RMarkdown documentation, but I found nothing.

Thanks everybody! And forgive me for my poor English...

Answer Source

From the documentation of knit_exit():

Sometimes we may want to exit the knitting process early, and completely ignore the rest of the document. This function provides a mechanism to terminate knit().




More text.




Everything after knit_exit() will be ignored. This works for all output formats.

The code above produces:

enter image description here