12.2 Exit knitting early
Sometimes we may want to exit knitting early and not at the end of the document. For example, we may be working on some analysis and only wish to share the first half of the results, or we may still be working on code at the bottom that is not yet complete. In these situations, we could consider using the
knit_exit() function in a code chunk, which will end the knitting process after that chunk.
Below is a simple example, where we have a very simple chunk followed by a more time-consuming one:
Normally you have to wait for 100 seconds, but since we have called
knit_exit(), the rest of the document will be ignored.