R Markdown

What is R Markdown: R Markdown is a useful tool that allows you to save and execute code, and generate shareable reports for stakeholders. As you learn more about how to use it, it can be helpful to bookmark some resources to refer to later.

YAML:


title: “practice”
author: “Floyd”
date: “2023-11-01”
output:
html_document: default
pdf_document: default

File Format:
.rmd

Metadata:


title: “R Markdown Intro”
author: “Floyd”
date: “2023-11-01”
output: html_document

Element Markdown Example
Headings #, ##, … # Heading 1, ## Heading 2, …
Lists -, *, + - Item 1, * Item 2, + Item 3
Ordered Lists 1., 2., … 1. First item, 2. Second item, …
Links [Link Text](URL) [OpenAI's Website](https://www.openai.com)
Emphasis *, _ *Italicized Text*, **Bold Text**
Blockquotes > > This is a blockquote.
Code inline code Use print("Hello, World!") to display…
Code Blocks language python def greet(name): print(f”Hello,…
Horizontal Rules ---, ***, ___ ---
Images ![Alt text](URL) ![Alt text](https://example.com/image.jpg)
Tables Pipes and hyphens See previous example in the text.
Bold Text ** **Bold Text**
Italics * or _ *Italicized Text*
Caption ![Alt text](URL) "Caption Text" ![Image](image.jpg "Image Caption")

This table format provides an overview of various Markdown elements, including those for

When creating headers keep the following in mind:

Headers will appear in blue

A single hashtag is the largest header

The more hashtags you add (up to six), the smaller the header

To format comments in your notebook, follow these steps:

1. Click in a line above the code chunk you added but below the YAML section.

2. Type a main header for your report using a single hashtag. You might want to restate the title in the YAML in a different way or add to it with a short description.

3. Add a smaller header below that to label the first part of your programming. Follow that with a description of the code chunk that you added.

Headings
Headings in Markdown are used to organize your content and create a hierarchy. Markdown supports six levels of headings, with “##” for the second level, “###” for the third level, and so on. Here’s an example:

Headings

Headings in Markdown are used to organize your content and create a hierarchy. Markdown supports six levels of headings, with “##” for the second level, “###” for the third level, and so on. Here’s an example:

markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

Lists

Markdown supports both ordered and unordered lists. To create an unordered list, use asterisks, plus signs, or hyphens as list markers:

markdown
- Item 1
- Item 2
- Subitem 1
- Subitem 2
* Item 3
+ Item 4

For ordered lists, use numbers followed by periods:

markdown
1. First item
2. Second item
3. Third item

Links

Creating hyperlinks in Markdown is simple. Use square brackets for the link text and parentheses for the URL:

markdown
[OpenAI's Website](https://www.openai.com)

You can also add optional title attributes to your links:

markdown
[Google](https://www.google.com "Google Homepage")

Emphasis

Markdown allows you to emphasize text in two ways: italics and bold. To italicize text, enclose it with asterisks or underscores:

markdown
*Italicized Text*
_Italicized Text_

For bold text, use double asterisks or underscores:

markdown
**Bold Text**
__Bold Text__

Blockquotes

Blockquotes are used to emphasize and distinguish quoted text. Simply prefix the text with a greater-than sign (>):

markdown
> This is a blockquote.

Code

To format inline code, wrap the code snippet in backticks ():

markdown
Use print("Hello, World!") to display a message.

For code blocks, use triple backticks with the language identifier for syntax highlighting:

<pre> python def greet(name): print(f”Hello, {name}!”) ` </pre>

Horizontal Rules

To create a horizontal rule, use three or more hyphens, asterisks, or underscores on a separate line:

markdown
---

Images

Including images in your Markdown document is similar to creating links, but with an exclamation mark in front of the square brackets:

markdown
![Alt text](https://example.com/image.jpg "Image Title")

Tables

Tables can be created using pipes (|) and hyphens. Use pipes to separate columns and hyphens to define the header row:

markdown
| Header 1 | Header 2 |
|----------|----------|
| Data 1 | Data 2 |
| Data 3 | Data 4 |

Markdown is a versatile and efficient way to format and structure text for various purposes, from writing documentation and blog posts to taking notes and creating README files. With these essential Markdown options in your toolkit, you can enhance your text and make it more readable and informative. Happy Markdown writing!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top