-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path04_MarkdownBasics.Rmd
133 lines (87 loc) · 2.91 KB
/
04_MarkdownBasics.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
title: "Basic Markdown"
author:
- Isabel Fernandez Escapa, [email protected]
output:
rmdformats::robobook:
use_bookdown: true
code_folding: show
---
```{r klippy, echo=FALSE, include=TRUE}
klippy::klippy(c('r', 'bash'))
```
This is an R Markdown document (`file.Rmd`). Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents.
Try using the *knit* function. All the packages and objects must be included in the script, knit doesn't take them from the local environment.
# Markdown Syntax (This is a primary heading)
This is sample sentence number 1.
This is sample sentence number 2. (Newlines require a double space!)
This is sample sentence number 3.
This is sample sentence number 4.
*This text will appear italicized!*
**This text will appear bold!**
\*literal asterisks\*
```
This text is fixed-width font that you can use for code blocks.
This text is displayed verbatim / preformatted
```
This text is in-line `fixed-width` font.
~~strikethrough~~
> This is the first level of quoting
>
> > This is nested block-quote
If you need to add extra space between lines use this:
<br></br>
<br></br>
<br></br>
<br></br>
Three or more asterisks or dashes make a Horizontal Rule / Page Break
*****
## Lists
- first item in list
- second item in list
- third item in list
* You don't need to use the same symbol all the time!
- And you can add levels
1. First item in list
5. The same works with numbers (even if you don't follow the right order)
2. Third item in list
3. ....
## Links
For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
You can also check [The Official Markdown Documentation](http://daringfireball.net/projects/markdown/basics)
In general [R Studio][1] and [Knirt][2] websites are really useful. (Have you seen the links at the bottom of the script?)
## Images
You can take them from the web:
![logo1](http://www.r-project.org/Rlogo.jpg)
Or use local files:
![logo2](figures/knit-logo.png)
[1]: http://www.rstudio.com/ "R Studio"
[2]: http://yihui.name/knitr/ "Knirt"
# Chunk options
Make a code chunk with three back ticks followed by an r in braces. End the chunk with three back ticks:
```{r}
mydata <- cars
head(mydata)
```
```{r}
plot(mydata)
```
You can modify the format of the plot using `fig.width =` and `fig.height =`:
```{r, fig.width = 12, fig.height = 5}
plot(mydata)
```
If you want to see the output but not the source code use the `echo = FALSE` parameter to prevent printing of the R code that generated the plot.
```{r, echo = FALSE}
summary(mydata)
```
You can also do `results = "hide"` and hide the resulting code instead.
```{r, results = 'hide'}
summary(mydata)
```
To include code output into the Markdown text use `r `:
```{r}
rand <- rnorm(1)
```
Here you have a random number: `r rand`.
******
For more details on using Knit chunk options go to <http://yihui.name/knitr/options>