RMarkdown is a tool for creating reproducible reports and documents from R code and output. It contains three main elements: a YAML header, text body, and code chunks. The YAML header contains metadata like the author and output format. The text body allows formatting like headings, lists, and tables. Code chunks allow embedding R code to be executed and output included in the document. Chunk options control code execution and figure formatting.
RMarkdown is a tool for creating reproducible reports and documents from R code and output. It contains three main elements: a YAML header, text body, and code chunks. The YAML header contains metadata like the author and output format. The text body allows formatting like headings, lists, and tables. Code chunks allow embedding R code to be executed and output included in the document. Chunk options control code execution and figure formatting.
RMarkdown is a tool for creating reproducible reports and documents from R code and output. It contains three main elements: a YAML header, text body, and code chunks. The YAML header contains metadata like the author and output format. The text body allows formatting like headings, lists, and tables. Code chunks allow embedding R code to be executed and output included in the document. Chunk options control code execution and figure formatting.
YAML header: body of the document where everything, surrounded by ---
Options: author, date, output format, table of content, themes, code folding, ... Text: body core, essential for explaining the analysis, syntax: o emphasis (*italics*, **bold**, or `code style`) o headers (# ## ###) o lists (* - + for unnumbered and 1. for numbered) o hyperlinks (<> ()[]) o blockquotes (>) o picture/gif ( !()[]) o tables (usually better to use knitr::kable()) o Latex using the syntax $math expression$ see mathpix o Cross-referencing sections using syntax \@ref(label) o Citations and bibliographies can automatically be generated with RMarkdow Code chunks: Code chunks are specific to RMarkdown. It allows to embed R code within your document To insert these chunks within your RMarkdown file, use either: o the keyboard shortcut Ctrl + Alt + I o the Add Chunk command in the editor toolbar o by typing the chunk delimiters ```{r label, some option} and ``` eval: (TRUE; logical) whether to evaluate the code chunk; echo: (TRUE; logical or numeric) whether to include R code in the output file; warning: (TRUE; logical) whether to preserve warnings (produced by warning()) in the output like we run R code in a terminal (if FALSE, all warnings will be printed in the console instead of the output document); cache: (FALSE; logical) whether to "cache" a code chunk. It may be convenient to avoid re-running the computations and save time. dependson: (label) allows to refer to objects in other chunk. Plot figure options: fig.path: ('figure/'; character) prefix to be used for figure filenames (fig.path and chunk labels are concatenated to make filenames); fig.show: ('asis'; character) how to show/arrange the plots; fig.width, fig.height: (both are 7; numeric) width and height of the plot, to be used in the graphics device (in inches) and have to be numeric; fig.align: ('default'; character) alignment of figures in the output document (possible values are left, right and center; fig.cap: (NULL; character) figure caption to be used in a figure environment.