Skip to content
Incomplete sheet

This sheet is incomplete and could use some attention. Please submit code snippet suggestions as an issue or PR here.

Rmarkdown

Page info

Action Code Details
Title
title: my title
Author
author: John Smith
Author with e-mail as footnote
author: John Smith^[example@example.com]
Authors
author:
  - Bert
  - Ernie
Date
date: 2024-07-17
Current date (dynamically)
date: "r format(Sys.time(), '%d %B %Y')"
Keywords
tags: [analysis, ai]

Text formatting

Action Code Details
Bold
**text**
Italic
*text*
Hyperlink with label
[Text](url)
Code
`code`
Equation
$\mu$

Document structuring

Sectioning

Action Code Details
Section
# Section title
Unnumbered section
# Section title {-}
Hide section from ToC
# Section title {.toc-ignore}
Tabbed section
## title {.tabset .tabset-fade}
content above tabbed region.

### tab 1
tab content 1

### tab 2
tab content 2

##
content below tabbed region
The newlines are crucial!
Subsection
## Subsection title
Subsubsection
### Subsubsection title
Paragraph
#### Paragraph title
Collapsible paragraph
<details>
<summary>Show details…</summary>
<p>Derp</p>
</details>
Horizontal line
***

Lists

Action Code Details
Define unordered list
* a
* b
Define nested list
* a
  + b
* c
Dynamic list from code section
```{r, results='asis'}
paste0('* ', items, collapse='
') %>% cat
</td>
<td markdown="1"></td>
</tr>
</table>
## Figures
<table markdown = "1">
<thead>
<tr>
<th class="th-action">Action</th>
<th class="th-code">Code</th>
<th class="th-details">Details</th>
</tr>
</thead>
<tr markdown="1">
<td markdown="1">
Captioned dynamic figure from R code
</td>
<td>
```md
```{r, fig.align="center", fig.width=6, fig.height=6,
    fig.cap="Figure: Your caption here."}
R CODE HERE
</td>
<td markdown="1"></td>
</tr>
<tr markdown="1">
<td markdown="1">
Dynamic subfigures from R code
</td>
<td>
```md
```{r out.width=c('50%', '50%'), fig.show='hold'}
boxplot(1:10)
plot(rnorm(10))
</td>
<td markdown="1"></td>
</tr>
<tr markdown="1">
<td markdown="1">
Interactive ggplot
</td>
<td>
```md
```{r}
p = ggplot(data, aes(x=x, y=y, color=z)) +
    geom_point()
plotly::ggplotly(p)
</td>
<td markdown="1"></td>
</tr>
</table>
## Tables
<table markdown = "1">
<thead>
<tr>
<th class="th-action">Action</th>
<th class="th-code">Code</th>
<th class="th-details">Details</th>
</tr>
</thead>
<tr markdown="1">
<td markdown="1">
Dataframe as table
</td>
<td>
```md
kable(df)
Dynamic sortable table from dataframe
DT::datatable(…)
Scrollable table from dataframe
DT::datatable(mtcars, rownames = FALSE,
    filter="top", options = list(pageLength = 5, scrollX=T) )
Named list as table
`r unlist(mylist) %>% as.data.frame %>% kable(col.names='Value')`
Knitr params list as table
`r unlist(params) %>% as.data.frame %>%
    kable(col.names='Value', caption='Parameters')`

Code block options

To hide code blocks by default, set code_folding: "hide" in the output document parameters.

Action Code Details
Run, show output only
echo=F
Run, show code only
echo=T, results='hide'
Show code, don't run
eval=F
Interpret output as markdown code
results='asis'
Hide messages
message=F
Hide warnings
warning=F