Here’s a cheat sheet for working with R Markdown:
Headers
Section Header:
# Section Title
Subsection Header:
## Subsection Title
Text Formatting
Bold Text:
**Bold Text**
Italic Text:
*Italic Text*
Strikethrough Text:
~~Strikethrough Text~~
Lists
Unordered List:
- Item 1
- Item 2
Ordered List:
1. First Item
2. Second Item
Links
Inline Link:
[Link Text](https://www.example.com)
Reference Link:
[Link Text][1]
[1]: https://www.example.com
Images
Inline Image:
![Alt Text](image_url)
Reference Image:
![Alt Text][1]
[1]: image_url
Code
Inline Code:
`inline_code()`
Code Block:
```{r}
code_chunk()
Tables
Simple Table:
| Header 1 | Header 2 |
|----------|----------|
| Content | Content |
Table Alignment:
| Left | Centered | Right |
|:---------|:---------:|---------:|
| Content | Content | Content |
R Code Chunks
Basic R Code Chunk:
```{r}
# R code here
With Output:
```{r, echo=FALSE}
summary(cars)
Blockquotes
Blockquote:
> This is a blockquote.
Math Equations
Inline Math:
$E=mc^2$
Display Math:
$$E=mc^2$$
Shiny App Embedding
Embed Shiny App:
```{r shiny_example, echo=FALSE}
library(shiny)
shinyApp(
ui = fluidPage("Hello Shiny!"),
server = function(input, output) { }
)
Slide Presentations
Create Slides:
---
title: "Presentation Title"
output: ioslides_presentation
---
Slide Breaks:
---
## Next Slide
YAML Front Matter
Configure Document:
---
title: "Document Title"
author: "Author Name"
output: html_document
---
This cheat sheet covers some basic and commonly used elements in R Markdown. For more details and advanced features, refer to the official R Markdown documentation.