Learn R Markdown Basics
We can have R codes, results and interpretation of results in one document by using R Notebook for the data analysis. R Notebook is an R Markdown document that can be executed independently and interactively, and it interacts with R directly while producing a reproducible document with publication-quality output.Therefore, at least a basic knowledge in R Markdown is needed to use R Markdown and R Notebook. Some basic concepts required are given below, and you can learn more by using the lessons given in RStudio website https://rmarkdown.rstudio.com/lesson-1.html.
R Markdown Basics
To start a new paragraph “end a line with two or more spaces”
To make the text *italics*: italics, write the relevant text within * or _ sign
To make the text **bold**: bold, write the relevant text within ** or __ sign
To use both **_italic and bold_** : italic and bold, write the relevant text within two astarics and underscore.
To obtain a superscript use superscript^2^: superscript^2^
To obtain a subcript use subscript~2~ : subscript~2~
To show ~~strikethrough~~: strikethrough
To add a URL to a text write the “Text within square brackets[], and write the URL of the website within normal brackets() [Text](URL of the website)
To add inline equation write the equation within two $ signs: $A = \pi*r^{2}$
To add an image to the document use 
To add an image in the web use 
To add a plain code blocks, write what you want to quote within two ``` signs.
To add a code, write the code using one tick sign that indicates in the above: code.
To show a web link use <URL>. Example https://pushpa-wijekoon.netlify.com
To add a footnote use footnote1 [^1] and then type your footnote as [^1]: My footnote.
Headings
You can use section headings by using # sign.
Examples:
The first level
# Heading 1givesHeading 1
The second level
## Heading 2givesHeading 2
The third level
### Heading 3givesHeading 3
The fourth level
#### Heading 4givesHeading 4
List Types
Ordered List
Suppose you have three items, and want to write them as
1. First item,
2. Second item and
3. Third item.
Then type them just as given above by giving the item number
- First item
- Second item
- Third item
Unordered List
To prepare unordered lists, use * sign and then a space before each item.
Example:
- List item
- Another item
- And another item
Nested list
To prepare nested lists, use * sign for the first level and then + sign for the next level.
Refer: https://rmarkdown.rstudio.com/authoring_basics.html
- First item
- Second item
- Second item First subitem
- Second item second subitem
- Second item Second subitem First sub-subitem
- Second item Second subitem Second sub-subitem
- Second item Second subitem Third sub-subitem
- Second item Third subitem
- Second item Third subitem First sub-subitem
- Second item Third subitem Second sub-subitem
- Second item Third subitem Third sub-subitem
- Third item
Blockquote with a citation
For block quote use > sign.
Where there is love there is life
Horizontal Rule / Page Break
Use three or more asterisks or dashes to insert a horizontal rule
Tables
Tables can be added to R Markdown as below, and refer: https://rmarkdown.rstudio.com/authoring_basics.html.
| ID | Month | Count | Year |
|---|---|---|---|
| 1 | January | 250 | 2009 |
| 2 | March | 300 | 2012 |
| 3 | May | 350 | 2010 |
Colons can be used to align columns as left, center or right.
| ID | Month | Count |
|---|---|---|
| align: left | align: center | align: right |
| align: left | align: center | align: right |
| align: left | align: center | align: right |
Superscript, subscript, highlight etc
superscript^2^ 2^10^ is 1024
You can also use HTML tags as below:
H<sub>2</sub>O → H2O
C<sub>6</sub>H<sub>12</sub>O<sub>6</sub> → C6H12O6
a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup> → a2 + b2 = c2
<kbd>ENTER</kbd> → ENTER
<kbd><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>F</kbd></kbd> → CTRL+ALT+F
<mark>Where there is love there is life</mark> → Where there is love there is life
<cite>Mahatma Gandhi</cite> → Mahatma Gandhi
References:
1. RStudio Lessons
2. R Markdown: The Definitive Guide