forked from saundersg/Statistics-Notebook
-
Notifications
You must be signed in to change notification settings - Fork 3
/
RMarkdownHints.Rmd
executable file
·330 lines (196 loc) · 6.07 KB
/
RMarkdownHints.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
---
title: "R Markdown Hints"
output:
html_document:
toc: true
toc_float: true
---
Think of an `R Markdown File`, or `Rmd` for short, as a command center. You write commands, then Knit the file, and an html output file is created according to your commands.
# Overview
## {.tabset .tabset-pills .tabset-fade}
### Click Here to Learn More
Carefully read through all parts of this image to learn...
![](./Images/Rmd2html.png)
### Close
##
----
The above tabs (blue bottons that read "Click Here to Learn More" and "Close") were created with the code:
## {.tabset .tabset-pills .tabset-fade}
### Click Here to Learn More
Carefully read through all parts of this image to learn...
![](./Images/Rmd2html.png)
### Close
##
----
# Creating Links
To make a link use the code `[Name of Link](addressForLink)`.
Linking to parts of your textbook:
* `[Numerical Summaries](NumericalSummaries.html)` *becomes* [Numerical Summaries](NumericalSummaries.html)
* `[Boxplots](GraphicalSummaries.html#boxplots)` *becomes* [Boxplots](GraphicalSummaries.html#boxplots)
* `[R Commands](RCommands.html)` *becomes* [R Commands](RCommands.html)
Linking to outside resources:
* `[R Colors](http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf)` *becomes* [R Colors](http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf)
# Creating Headers
There are six available sizes of headings you can use in an Rmd file (left in image) that show up as shown below (right in image).
![](./Images/Rmd2html_Headers.png)
<br />
# Emphasizing Words
To *italisize* a word use the asterisk (Shift 8) `*italisize*`. To **bold** a word use the double asterisk `**bold**`. The back tic ` ` ` can be used to `highlight` words by placing back tics on each side of a word: ` ` ` highlight ` ` `.
<br />
# Bullet Points
## Simple Lists
<div style="float:left;width:300px;">
To achieve the result:
* This is the first item.
* This is the second.
* This is the third.
</div>
<div style="padding-left:350px;">
Use the code:
```{r, eval=FALSE}
To achieve the result:
* This is the first item.
* This is the second.
* This is the third.
```
</div>
<div style="clear:both;"></div>
## Numbered Lists
<div style="float:left;width:300px;">
To achieve the result:
1. This is the first item.
2. This is the second.
3. This is the third.
</div>
<div style="padding-left:350px;">
Use the code:
```{r, eval=FALSE}
To achieve the result:
1. This is the first item.
2. This is the second.
3. This is the third.
```
</div>
<div style="clear:both;"></div>
## Lettered Lists
<div style="float:left;width:300px;">
To achieve the result:
A) This is the first item.
B) This is the second.
C) This is the third.
</div>
<div style="padding-left:350px;">
Use the code:
```{r, eval=FALSE}
To achieve the result:
A) This is the first item.
B) This is the second.
C) This is the third.
```
</div>
<div style="clear:both;"></div>
## Nested Lists
<div style="float:left;width:300px;">
1. What is $2+2$?
a. **4**
b. 8
2. What is $3\times5$?
a. 14
b. **15**
</div>
<div style="padding-left:350px;">
```{r, eval=FALSE}
1. What is $2+2$?
a. **4**
b. 8
2. What is $3\times5$?
a. 14
b. **15**
```
</div>
# Math Equations
Use the dollar signs `$x=5$` to write $x=5$ or `$z=\frac{x-\mu}{\sigma}$` to write $z=\frac{x-\mu}{\sigma}$. For a nicely centered equation use the double dollar signs `$$ $$` on separate lines
```{}
$$
z = \frac{\bar{x}-\mu}{\frac{\sigma}{\sqrt{n}}}
$$
```
to get
$$
z = \frac{\bar{x}-\mu}{\frac{\sigma}{\sqrt{n}}}
$$
Or
```{}
$$
H_0: \mu_\text{Group 1} = \mu_\text{Group 2}
$$
$$
H_a: \mu_\text{Group 1} \neq \mu_\text{Group 2}
$$
```
to get
$$
H_0: \mu_{\text{Group 1}} = \mu_{\text{Group 2}}
$$
$$
H_a: \mu_{\text{Group 1}} \neq \mu_{\text{Group 2}}
$$
Symbol list:
| Symbol | LaTeX Math Code |
|--------|------------------|
| $\alpha$ | `$\alpha$` |
| $\beta$ | `$\beta$` |
| $\sigma$ | `$\sigma$` |
| $\epsilon$ | `$\epsilon$` |
| $\bar{x}$ | `$\bar{x}$` |
| $\hat{Y}$ | `$\hat{Y}$` |
| $=$ | `$=$` |
| $\ne$ | `$\ne$` or `$\neq$` |
| $>$ | `$>$` |
| $<$ | `$<$` |
| $\ge$ | `$\ge$` |
| $\le$ | `$\le$` |
| $\{ \}$ | `$\{ \}$` |
| $\text{Type just text}$ | `$\text{Type just text}$` |
| $\overbrace{Y_i}^\text{label}$ | `$\overbrace{Y_i}^\text{label}$`|
| $\underbrace{Y_i}_\text{label}$ | `$\underbrace{Y_i}_\text{label}$`|
Here is a list of [*all* supported LaTeX commands](http://docs.mathjax.org/en/latest/input/tex/macros/index.html#tex-commands).
<br />
# Insert a Picture
To add a picture to your document, say some notes you took down on paper from class,
Use the code: `![](./Images/insertPictureNotes.jpg)` to get...
![](./Images/insertPictureNotes.jpg)
<br />
# Tables
There are many ways to [make tables](http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html#tables) in R Markdown. Here is a simple way to make a "pipe" table.
```{r, eval=FALSE}
| Name | Age | Gender |
|---------------|---------------|--------------|
| Jill | 8 | Female |
| Jack | 9 | Male |
```
| Name | Age | Gender |
|---------------|---------------|--------------|
| Jill | 8 | Female |
| Jack | 9 | Male |
<br />
# Themes
Notice in the YAML (at the top of the RMD file) there is a line that reads:
"theme: cerulean"
Other possible themes are
* "default", "cerulean", "journal", "flatly", "readable", "spacelab", "united", and "cosmo".
You can also change the `highlighting` by adding the line "highlight: tango" to the YAML as follows.
```{r, eval=FALSE}
---
title: "Markdown Hints"
output:
html_document:
theme: cerulean
highlight: tango
---
```
Other highlighting options are
* "default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn", "haddock", and "textmate".
<br />
# More Information
Go to the [rmarkdown.rstudio.com](http://rmarkdown.rstudio.com/html_document_format.html) website for more information on how to use R Markdown.