![]() ![]() Global chunk options You may be inclined to use largely the same set of chunk options throughout a document. So resultshide is wrong you need results'hide'. ![]() ![]() Each must be real R code, as R will be used to evaluate them. This means that for this code-chunk, the include option will be set as FALSE (we’ll learn what that actually does in just a minute!). 11.7Hide code, text output, messages, or plots 11.8Hide everything from a chunk 11.9Collapse text output blocks into source blocks 11.10Reformat R source code 11.11Output text as raw Markdown content () 11.12Remove leading hashes in text output 11. There are lots of different possible chunk options. For instance, do we want the code to be shown in the document? Do we want the output to be shown? Do we even want the code to be evaluated, or do we want R to skip over it? These things are all controlled via “chunk options”. Chunk optionsĪlong with providing a name for each code-chunk, we can specify how we want it to compile in our finished document. One immediate benefit is that you can easily navigate through your document to get to the code-chunk you want, by using the menu in the bottom-left of the editor in RStudio: include FALSE: Runs code, but suppresses all output. It will still include the code but can only be seen once a user clicks on this. eval FALSE: Show code, but do not evaluate it. For HTML outputs, we can use code folding to hide the code in the output file. This will come in handy later on when we want to reference the output from certain code-chunks. Mastering these code chunk options is essential to becoming a proficient R Markdown user: echo FALSE: Hide the code, but run code and produce all outputs, plots, warnings and messages. ![]()
0 Comments
Leave a Reply. |