An R Markdown document will have often have many code chunks.
If the code produces a figure, that figure will be inserted.
But sometimes your code can be overwhelming and not particularly pleasant for non-coders who are trying to read just the narrative of your work and are not interested in the intricacies of how you conducted the analysis. When you process the R Markdown document with knitr, each of the code chunks will be evaluated, and then the code and/or output will be inserted (unless you suppress one or both with chunk options, described below). If you need to specify options when loading the package, you. This is useful if you need to load multiple packages: - title: 'Untitled' output: pdfdocument: extradependencies: 'bbm', 'threeparttable'. If you prefer that data be displayed with additional formatting you can use the knitr::kable function, as in the. RMarkdown is a great way to record your work, allowing you to write a narrative and capture your code all in one place. As of rmarkdown version 1.4 it has been possible to use the extradependencies parameter to list a character vector of LaTeX packages. Output your document in the format specified in your YAML header with Command + Shift + K on a Mac, or Ctrl + Shift + K on Linux and Windows.
In an R/Markdown document that I want to convert to LaTeX I want to set knitr options so that the entire document uses plain code chunks for all code inputs by default. By default, R Markdown displays data frames and matrixes as they would be in the R terminal (in a monospaced font). Here are some of the essential R Markdown shortcuts: Insert a new code chuck with Command + Option + I on a Mac, or Ctrl + Alt + I on Linux and Windows.