---
title: 'RMarkdown Header'
subtitle: 'Template for RMarkdown files.'
author: 'Amir Freund'
date: '`r Sys.Date()`'
output:
html_document:
code_folding: hide # show / hide
toc: true # table of content true
toc_depth: 3 # upto three depths of headings (specified by #, ## and ###)
toc_float: # Allows the TOC to float on the page.
collapsed: false # Ensures the TOC is expanded by default and not collapsible.
theme: flatly
highlight: tango
number_sections: true ## if you want number sections at each table header
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
fig.width = 10,
fig.height = 7,
echo = TRUE,
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = ''
)
```
This document explains each component of the R Markdown header configuration and its purpose.
The header begins with three dashes (---
) and contains
YAML (YAML Ain’t Markup Language) metadata that controls the document’s
appearance and behavior.
title
: Sets the document’s main titleauthor
: Specifies the document’s authordate
: Uses R code (2025-02-05
) to
automatically insert the current dateSpecifies that the document will be rendered as HTML with the following settings:
hide
: Code is hidden by default but can be
expandedshow
(always visible) or
none
(always hidden)toc: true
: Enables table of contentstoc_depth: 3
: Includes headings up to three levels deep
(# to ###)toc_float
: Makes the table of contents float alongside
the content
collapsed: false
: TOC is fully expanded by defaultknitr::opts_chunk$set(
fig.width = 10,
fig.height = 7,
echo = TRUE,
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = ""
)
This R code chunk sets global options for all subsequent code chunks:
fig.width = 10
: Sets default figure width to 10
inchesfig.height = 7
: Sets default figure height to 7
inchesecho = TRUE
: Shows R code along with its outputwarning = FALSE
: Suppresses warning messagesmessage = FALSE
: Suppresses informational messagescollapse = TRUE
: Combines code and output into a single
blockcomment = ""
: Do not prefix output lines with “”