-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lesson1.html
852 lines (759 loc) · 55.1 KB
/
Lesson1.html
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title></title>
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/lumen.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<script src="site_libs/navigation-1.1/codefolding.js"></script>
<script src="site_libs/navigation-1.1/sourceembed.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css" data-origin="pandoc">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; background-color: #f8f8f8; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
pre, code { background-color: #f8f8f8; }
code > span.kw { color: #204a87; font-weight: bold; } /* Keyword */
code > span.dt { color: #204a87; } /* DataType */
code > span.dv { color: #0000cf; } /* DecVal */
code > span.bn { color: #0000cf; } /* BaseN */
code > span.fl { color: #0000cf; } /* Float */
code > span.ch { color: #4e9a06; } /* Char */
code > span.st { color: #4e9a06; } /* String */
code > span.co { color: #8f5902; font-style: italic; } /* Comment */
code > span.ot { color: #8f5902; } /* Other */
code > span.al { color: #ef2929; } /* Alert */
code > span.fu { color: #000000; } /* Function */
code > span.er { color: #a40000; font-weight: bold; } /* Error */
code > span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #000000; } /* Constant */
code > span.sc { color: #000000; } /* SpecialChar */
code > span.vs { color: #4e9a06; } /* VerbatimString */
code > span.ss { color: #4e9a06; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #000000; } /* Variable */
code > span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */
code > span.op { color: #ce5c00; font-weight: bold; } /* Operator */
code > span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */
code > span.ex { } /* Extension */
code > span.at { color: #c4a000; } /* Attribute */
code > span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */
code > span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */
.sourceCode .row {
width: 100%;
}
.sourceCode {
overflow-x: auto;
}
.code-folding-btn {
margin-right: -30px;
}
</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
try { var rules = sheets[i].cssRules; } catch (e) { continue; }
for (var j = 0; j < rules.length; j++) {
var rule = rules[j];
// check if there is a div.sourceCode rule
if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
var style = rule.style.cssText;
// check if color or background-color is set
if (rule.style.color === '' && rule.style.backgroundColor === '') continue;
// replace div.sourceCode by a pre.sourceCode rule
sheets[i].deleteRule(j);
sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
}
}
})();
</script>
<style type="text/css">
pre:not([class]) {
background-color: white;
}
</style>
<style type="text/css">
h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}
#rmd-source-code {
display: none;
}
</style>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
</style>
<style type="text/css">
/* padding for bootstrap navbar */
body {
padding-top: 54px;
padding-bottom: 40px;
}
/* offset scroll position for anchor links (for fixed navbar) */
.section h1 {
padding-top: 59px;
margin-top: -59px;
}
.section h2 {
padding-top: 59px;
margin-top: -59px;
}
.section h3 {
padding-top: 59px;
margin-top: -59px;
}
.section h4 {
padding-top: 59px;
margin-top: -59px;
}
.section h5 {
padding-top: 59px;
margin-top: -59px;
}
.section h6 {
padding-top: 59px;
margin-top: -59px;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #cccccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #ffffff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
border-radius: 6px 0 6px 6px;
}
</style>
<script>
// manage active state of menu based on current page
$(document).ready(function () {
// active menu anchor
href = window.location.pathname
href = href.substr(href.lastIndexOf('/') + 1)
if (href === "")
href = "index.html";
var menuAnchor = $('a[href="' + href + '"]');
// mark it active
menuAnchor.parent().addClass('active');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
});
</script>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
background: white;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
<style type="text/css">
.code-folding-btn { margin-bottom: 4px; }
</style>
<style type="text/css">
#TOC {
margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
position: relative;
width: 100%;
}
}
@media print {
.toc-content {
/* see https://github.com/w3c/csswg-drafts/issues/4434 */
float: right;
}
}
.toc-content {
padding-left: 30px;
padding-right: 40px;
}
div.main-container {
max-width: 1200px;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 85%;
}
@media (min-width: 768px) and (max-width: 991px) {
div.tocify {
width: 25%;
}
}
@media (max-width: 767px) {
div.tocify {
width: 100%;
max-width: none;
}
}
.tocify ul, .tocify li {
line-height: 20px;
}
.tocify-subheader .tocify-item {
font-size: 0.90em;
}
.tocify .list-group-item {
border-radius: 0px;
}
</style>
</head>
<body>
<div class="container-fluid main-container">
<!-- setup 3col/9col grid for toc_float and main content -->
<div class="row-fluid">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">R Coding Club</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="Lesson1.html">Lesson 1</a>
</li>
<li>
<a href="Lesson2.html">Lesson 2</a>
</li>
<li>
<a href="Lesson3.html">Lesson 3</a>
</li>
<li>
<a href="Lesson4.html">Lesson 4</a>
</li>
<li>
<a href="Lesson5.html">Lesson 5</a>
</li>
<li>
<a href="Lesson6.html">Lesson 6</a>
</li>
<li>
<a href="Lesson7.html">Lesson 7</a>
</li>
<li>
<a href="Lesson8.html">Lesson 8</a>
</li>
<li>
<a href="Lesson9.html">Lesson 9</a>
</li>
<li>
<a href="Lesson10.html">Lesson 10</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/darwinanddavis/EmoRyCodingClub">
<span class="fa fa-github"></span>
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div class="fluid-row" id="header">
<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button>
<ul class="dropdown-menu" style="min-width: 50px;">
<li><a id="rmd-show-all-code" href="#">Show All Code</a></li>
<li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li>
<li role="separator" class="divider"></li>
<li><a id="rmd-download-source" href="#">Download Rmd</a></li>
</ul>
</div>
</div>
<p><br />
<!-- install packages --></p>
<!-- ____________________________________________________________________________ -->
<!-- ____________________________________________________________________________ -->
<!-- ____________________________________________________________________________ -->
<!-- start body -->
<div id="lesson-1-intro-to-plotting-data-in-r-with-ggplot" class="section level1">
<h1>Lesson 1: Intro to plotting data in R with <code>ggplot</code></h1>
<p> </p>
<p>Functions for Lesson 1<br />
<code>?</code>, <code>str</code>, <code>glimpse</code>, <code>summary</code>, <code>table</code>, <code>min</code>, <code>max</code>, <code>ggplot</code>, <code>geom_point</code>, <code>geom_smooth</code>, <code>theme_minimal</code>, <code>theme_classic</code>, <code>theme_tufte</code><br />
</p>
<p>Packages for Lesson 1<br />
<code>tidyverse</code>, <code>ggplot2</code>, <code>dplyr</code><br />
</p>
</div>
<div id="agenda" class="section level1">
<h1>Agenda</h1>
<p><a href="https://r4ds.had.co.nz/data-visualisation.html">Data visualisation in <code>R</code> for Data Science, Section 3.1.1</a>.</p>
<!-- end yaml template------------------------------------------------------- -->
<ul>
<li>Intro to the <code>R</code>environment (IDE)<br />
</li>
<li>Loading packages, e.g. <code>tidyverse</code><br />
</li>
<li>Using built-in <code>R</code> data: the <code>mpg</code> dataset<br />
</li>
<li>Using ggplot with the built-in data set (to make scatterplots)<br />
</li>
<li>Modifying plot aesthetics<br />
</li>
<li>Reading in outside data: Airbnb data<br />
</li>
<li>Plotting Airbnb data with ggplot</li>
</ul>
<p> </p>
</div>
<div id="intro-to-the-r-environment-ide" class="section level1">
<h1>Intro to the <code>R</code> environment (IDE)</h1>
<p>The <code>RStudio</code> integrated development environment (IDE) and what you can do with it.<br />
</p>
<!-- ----------------------- image --------------------------- -->
<div align="center">
<p><img src="img/rstudio1.jpg" style=width:100%></p>
</div>
<!-- ----------------------- image --------------------------- -->
<p> </p>
<p>A more complete example of what you can acheive with the interface.<br />
</p>
<!-- ----------------------- image --------------------------- -->
<div align="center">
<p><img src="img/rstudio2.jpg" style=width:100%></p>
</div>
<!-- ----------------------- image --------------------------- -->
<p> </p>
</div>
<div id="loading-packages-e.g.-tidyverse" class="section level1">
<h1>Loading packages, e.g. <code>tidyverse</code></h1>
<p>How to load packages in <code>R</code>.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">install.packages</span>(<span class="st">"tidyverse"</span>) <span class="co"># install package</span>
<span class="kw">library</span>(tidyverse) <span class="co"># load the package library</span>
<span class="kw">require</span>(tidyverse) <span class="co"># same as library </span>
<span class="co"># We are typing in an R Script. Things with # in front make them comments and notes to ourselves</span>
<span class="co"># Command Return to execute the line/ 'run the code'</span></code></pre></div>
<p> </p>
</div>
<div id="using-built-in-r-data-the-mpg-dataset" class="section level1">
<h1>Using built-in <code>R</code> data: the <code>mpg</code> dataset</h1>
<p><a href="https://r4ds.had.co.nz/data-visualisation.html#the-mpg-data-frame">Section 3.2.1</a></p>
<p>We'll use a built-in tidyverse dataset called <code>mpg</code> with data about cars and gas-mileage.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">mpg
<span class="co"># run help page with '?'</span>
<span class="st">`</span><span class="dt">?</span><span class="st">`</span>(mpg)</code></pre></div>
<ul>
<li>This is a tibble (data frame) that we've "printed" out. It's like R's version of an excel spreadsheet, but much better.</li>
<li>A tibble will show us the first 10 rows, rows containing the data, column names, and the class of data within each column, such as numeric, integer, or character.</li>
</ul>
<div id="summarising-data" class="section level2">
<h2>Summarising data</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">str</span>(mpg) <span class="co"># structure of data</span>
<span class="kw">glimpse</span>(mpg) <span class="co"># preview of data </span>
<span class="kw">summary</span>(mpg) <span class="co"># basic summary stats </span>
<span class="kw">table</span>(mpg<span class="op">$</span>manufacturer) <span class="co"># counts of each column</span>
<span class="kw">head</span>(mpg) <span class="co"># visualise first 6 rows of data</span>
<span class="kw">tail</span>(mpg, <span class="dv">10</span>) <span class="co"># visualise last 10 (or N) rows of data </span>
<span class="kw">names</span>(mpg) <span class="co"># get column names</span>
<span class="kw">class</span>(mpg) <span class="co"># class of data frame</span>
<span class="kw">class</span>(mpg<span class="op">$</span>manufacturer) <span class="co"># class of data column</span>
mpg<span class="op">$</span>displ <span class="co"># print a column</span>
mpg<span class="op">$</span>hwy <span class="co"># print a column</span></code></pre></div>
<p> </p>
</div>
</div>
<div id="creating-a-plot-with-ggplot" class="section level1">
<h1>Creating a plot with <code>ggplot</code></h1>
<p><a href="https://r4ds.had.co.nz/data-visualisation.html#creating-a-ggplot">Section 3.2.2</a></p>
<ul>
<li><code>ggplot()</code> Creates a coordinate system for us--basically an empty graph.<br />
</li>
<li><code>geom_point()</code> Adds a "layer", e.g. geom_point (but there are many for different kinds of graphs).</li>
</ul>
<p>Plot two of the data columns</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> mpg) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy))</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-4-1.png" width="672" /> </p>
<p>Changing the data column inputs for the <strong>x</strong> and <strong>y</strong> axis of the plot</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> mpg) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> class, <span class="dt">y =</span> drv))</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-5-1.png" width="672" /> </p>
<p>Assign data to variables to create dynamic inputs</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">my_data <-<span class="st"> </span>mpg <span class="co"># create own variable using a name of your choice </span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy))</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-6-1.png" width="672" /> </p>
<div id="themes" class="section level2">
<h2>Themes</h2>
<p>Change plot style. Link for more <a href="https://www.datanovia.com/en/blog/ggplot-themes-gallery/">ggplot themes</a>.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">require</span>(ggthemes)
<span class="co"># classic theme</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy)) <span class="op">+</span><span class="st"> </span><span class="kw">theme_minimal</span>()</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-7-1.png" width="672" /></p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># minimal theme</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy)) <span class="op">+</span><span class="st"> </span><span class="kw">theme_tufte</span>()</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-7-2.png" width="672" /></p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># assign theme to variable</span>
my_theme <-<span class="st"> </span><span class="kw">theme_classic</span>()
<span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy)) <span class="op">+</span><span class="st"> </span>my_theme <span class="co"># apply your chosen theme </span></code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-7-3.png" width="672" /> </p>
</div>
</div>
<div id="aesthetic-mapping" class="section level1">
<h1>Aesthetic mapping</h1>
<p><a href="https://r4ds.had.co.nz/data-visualisation.html#aesthetic-mappings">Section 3.3</a></p>
<p><code>colour</code>. Change the colour of the data points. <code>size</code>. Change the size of the data points.<br />
<code>alpha</code>. Change the transparency of the data points.</p>
<div id="colour" class="section level2">
<h2>Colour</h2>
<p>Colour by colour name.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy), <span class="dt">colour =</span> <span class="st">"light blue"</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-8-1.png" width="672" /> </p>
<p>Colour by a <a href="https://htmlcolorcodes.com/color-picker/">hex code</a> in quotes.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy), <span class="dt">colour =</span> <span class="st">"#BB5C42"</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-9-1.png" width="672" /> </p>
<p>colour by data column</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">colour =</span> class)) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-10-1.png" width="672" /> </p>
<p>Inside versus outside the <code>aes</code></p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">colour =</span> <span class="st">"blue"</span>)) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-11-1.png" width="672" /> </p>
</div>
<div id="size" class="section level2">
<h2>Size</h2>
<p>Size by integer</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">size =</span> <span class="dv">5</span>)) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-12-1.png" width="672" /> </p>
<p>Size by data column</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">size =</span> class)) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-13-1.png" width="672" /> </p>
<p>We get a warning, but this is okay.<br />
</p>
</div>
<div id="transparency" class="section level2">
<h2>Transparency</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># map classe column to different transparencies</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">alpha =</span> class)) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-14-1.png" width="672" /> </p>
</div>
<div id="shape" class="section level2">
<h2>Shape</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">shape =</span> class)) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-15-1.png" width="672" /> </p>
<p>Any warnings? Yes, because shape maxes out at six levels. </p>
</div>
<div id="manually-changing-aesthetic-properties" class="section level2">
<h2>Manually changing aesthetic properties</h2>
<p>But we can <em>set</em> the aesthetic properties manually, instead of having ggplot do the scaling automatically. For example, we can make our ggplot points all blue like this. This time, putting colour OUTSIDE the <code>aes</code> argument.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy), <span class="dt">colour =</span> <span class="st">"blue"</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-16-1.png" width="672" /> </p>
<p>Using colour both inside and outside the aes</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">colour =</span> class), <span class="dt">colour =</span> <span class="st">"#AE42BB"</span>) <span class="op">+</span><span class="st"> </span>
<span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-17-1.png" width="672" /> </p>
<p><strong>The inner one is overridden.</strong><br />
</p>
<p>Putting it all together as a snapshot of what's possible</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">ggplot</span>(<span class="dt">data =</span> my_data) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> displ, <span class="dt">y =</span> hwy, <span class="dt">colour =</span> class, <span class="dt">size =</span> class, <span class="dt">alpha =</span> class)) <span class="op">+</span><span class="st"> </span>
<span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-18-1.png" width="672" /></p>
</div>
<div id="aesthetics-you-can-manually-set" class="section level2">
<h2>Aesthetics you can manually set</h2>
<ul>
<li>The name of a colour as a character string.</li>
<li>The size of a point in mm.</li>
<li>The shape of a point as a number, as shown in Figure 3.1.</li>
</ul>
<!-- ----------------------- image --------------------------- -->
<div align="center">
<p><img src="img/shapes.png" style=width:100%></p>
</div>
<!-- ----------------------- image --------------------------- -->
<p> </p>
<p><code>R</code> has 25 built in shapes that are identified by numbers. There are some seeming duplicates: for example, 0, 15, and 22 are all squares. The difference comes from the interaction of the <code>colour</code> and <code>fill</code> aesthetics. The hollow shapes (0--14) have a border determined by <code>colour</code>; the solid shapes (15--18) are filled with <code>colour</code>; the filled shapes (21--24) have a border of <code>colour</code> and are filled with <code>fill</code>.</p>
</div>
</div>
<div id="further-plotting-examples" class="section level1">
<h1>Further plotting examples</h1>
<p><a href="https://r4ds.had.co.nz/data-visualisation.html#exercises-1">Section 3.3.1</a></p>
<p>The online reference contains further examples of how to visualise your data.</p>
</div>
<div id="reading-in-outside-data-nyc-airbnb-data" class="section level1">
<h1>Reading in outside data: NYC Airbnb data</h1>
<pre><code># A tibble: 6 x 74
id listing_url scrape_id last_scraped name description neighborhood_ov… picture_url host_id
<dbl> <chr> <dbl> <date> <chr> <chr> <chr> <chr> <dbl>
1 2595 https://www… 2.02e13 2021-04-09 Skyli… "Beautiful,… Centrally locat… https://a0… 2845
2 3831 https://www… 2.02e13 2021-04-12 Whole… "Enjoy 500 … Just the right … https://a0… 4869
3 5121 https://www… 2.02e13 2021-04-09 Bliss… "<b>The spa… <NA> https://a0… 7356
4 5136 https://www… 2.02e13 2021-04-10 Spaci… "We welcome… <NA> https://a0… 7378
5 5178 https://www… 2.02e13 2021-04-12 Large… "Please don… Theater distric… https://a0… 8967
6 5203 https://www… 2.02e13 2021-04-09 Cozy … "Our best g… Our neighborhoo… https://a0… 7490
# … with 65 more variables: host_url <chr>, host_name <chr>, host_since <date>,
# host_location <chr>, host_about <chr>, host_response_time <chr>, host_response_rate <chr>,
# host_acceptance_rate <chr>, host_is_superhost <lgl>, host_thumbnail_url <chr>,
# host_picture_url <chr>, host_neighbourhood <chr>, host_listings_count <dbl>,
# host_total_listings_count <dbl>, host_verifications <chr>, host_has_profile_pic <lgl>,
# host_identity_verified <lgl>, neighbourhood <chr>, neighbourhood_cleansed <chr>,
# neighbourhood_group_cleansed <chr>, latitude <dbl>, longitude <dbl>, property_type <chr>,
# room_type <chr>, accommodates <dbl>, bathrooms <lgl>, bathrooms_text <chr>, bedrooms <dbl>,
# beds <dbl>, amenities <chr>, price <chr>, minimum_nights <dbl>, maximum_nights <dbl>,
# minimum_minimum_nights <dbl>, maximum_minimum_nights <dbl>, minimum_maximum_nights <dbl>,
# maximum_maximum_nights <dbl>, minimum_nights_avg_ntm <dbl>, maximum_nights_avg_ntm <dbl>,
# calendar_updated <lgl>, has_availability <lgl>, availability_30 <dbl>, availability_60 <dbl>,
# availability_90 <dbl>, availability_365 <dbl>, calendar_last_scraped <date>,
# number_of_reviews <dbl>, number_of_reviews_ltm <dbl>, number_of_reviews_l30d <dbl>,
# first_review <date>, last_review <date>, review_scores_rating <dbl>,
# review_scores_accuracy <dbl>, review_scores_cleanliness <dbl>, review_scores_checkin <dbl>,
# review_scores_communication <dbl>, review_scores_location <dbl>, review_scores_value <dbl>,
# license <lgl>, instant_bookable <lgl>, calculated_host_listings_count <dbl>,
# calculated_host_listings_count_entire_homes <dbl>,
# calculated_host_listings_count_private_rooms <dbl>,
# calculated_host_listings_count_shared_rooms <dbl>, reviews_per_month <dbl></code></pre>
<p> </p>
<p>Using a smaller dataset</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># smaller csv file (16 cols)</span>
url <-<span class="st"> "http://data.insideairbnb.com/united-states/ny/new-york-city/2021-04-07/data/listings.csv.gz"</span>
nyc <-<span class="st"> </span><span class="kw">read_csv</span>(url)
nyc <-<span class="st"> </span>nyc[nyc<span class="op">$</span>id <span class="op"><</span><span class="st"> </span><span class="dv">20000</span>, ] <span class="co"># get smaller subet of data</span>
<span class="kw">length</span>(nyc<span class="op">$</span>id) <span class="co"># print length of 'id' column</span>
<span class="kw">head</span>(nyc)</code></pre></div>
<p> </p>
</div>
<div id="plotting-airbnb-data-with-ggplot" class="section level1">
<h1>Plotting AirBnB data with ggplot</h1>
<p>Using the above plotting functions to visualise the AirBnB data</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># plot neighborhood_group vs price</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> nyc) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> neighbourhood_group_cleansed, <span class="dt">y =</span> price, <span class="dt">colour =</span> neighbourhood_group_cleansed),
<span class="dt">shape =</span> <span class="dv">21</span>, <span class="dt">stroke =</span> <span class="dv">1</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-21-1.png" width="672" /></p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># plot minimum_nights vs price</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> nyc) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> minimum_nights, <span class="dt">y =</span> price, <span class="dt">colour =</span> neighbourhood_group_cleansed),
<span class="dt">shape =</span> <span class="dv">20</span>, <span class="dt">size =</span> <span class="dv">3</span>, <span class="dt">stroke =</span> <span class="dv">1</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-22-1.png" width="672" /></p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># availability_365 vs price</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> nyc) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> availability_<span class="dv">365</span>, <span class="dt">y =</span> price, <span class="dt">colour =</span> neighbourhood_group_cleansed),
<span class="dt">shape =</span> <span class="dv">21</span>, <span class="dt">stroke =</span> <span class="dv">1</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-23-1.png" width="672" /></p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># plot longitude vs price</span>
<span class="kw">ggplot</span>(<span class="dt">data =</span> nyc) <span class="op">+</span><span class="st"> </span><span class="kw">geom_point</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> longitude, <span class="dt">y =</span> price, <span class="dt">colour =</span> neighbourhood_group_cleansed),
<span class="dt">shape =</span> <span class="dv">21</span>, <span class="dt">stroke =</span> <span class="dv">1</span>) <span class="op">+</span><span class="st"> </span>my_theme</code></pre></div>
<p><img src="Lesson1_files/figure-html/unnamed-chunk-24-1.png" width="672" /></p>
<p>Try your own plot using the other variables in the dataset</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># plot neighborhood_group vs price</span>
<span class="kw">names</span>(airbnb)
<span class="kw">glimpse</span>(airbnb)
my_data <-<span class="st"> </span><span class="ot">NULL</span>
x <-<span class="st"> </span><span class="ot">NULL</span>
y <-<span class="st"> </span><span class="ot">NULL</span>
colour <-<span class="st"> </span><span class="ot">NULL</span>
shape <-<span class="st"> </span><span class="ot">NULL</span>
stroke <-<span class="st"> </span><span class="ot">NULL</span></code></pre></div>
<!-- end body -->
<!-- ____________________________________________________________________________ -->
<!-- ____________________________________________________________________________ -->
<!-- ____________________________________________________________________________ -->
</div>
<div id="rmd-source-code">LS0tCnBhcmFtczoKICBsZXNzb246ICJMZXNzb24gMSIKICB0aXRsZTogIkludHJvIHRvIHBsb3R0aW5nIGRhdGEgaW4gUiB3aXRoIGBnZ3Bsb3RgIgogIGJvb2tjaGFwdGVyX25hbWU6ICJTZWN0aW9uIDMuMS4xIiAgICAKICBib29rY2hhcHRlcl9zZWN0aW9uOiAiaHR0cHM6Ly9yNGRzLmhhZC5jby5uei9kYXRhLXZpc3VhbGlzYXRpb24uaHRtbCIKICBmdW5jdGlvbnM6ICJgP2AsIGBzdHJgLCBgZ2xpbXBzZWAsIGBzdW1tYXJ5YCwgYHRhYmxlYCwgYG1pbmAsIGBtYXhgLCBgZ2dwbG90YCwgYGdlb21fcG9pbnRgLCBgZ2VvbV9zbW9vdGhgLCBgdGhlbWVfbWluaW1hbGAsIGB0aGVtZV9jbGFzc2ljYCwgYHRoZW1lX3R1ZnRlYCIKICBwYWNrYWdlczogImB0aWR5dmVyc2VgLCBgZ2dwbG90MmAsIGBkcGx5cmAiICAgICAgCiAgIyBlbmQgaW5wdXRzIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpoZWFkZXItaW5jbHVkZXM6IFx1c2VwYWNrYWdle2Zsb2F0fQphbHdheXNfYWxsb3dfaHRtbDogeWVzCm91dHB1dDoKICBodG1sX2RvY3VtZW50OgogICAgY29kZV9mb2xkaW5nOiBzaG93CiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlCi0tLQogIApgYGB7ciwgc2V0dXAsIGVjaG8gPSBGQUxTRSwgY2FjaGUgPSBGQUxTRSwgaW5jbHVkZSA9IEZBTFNFfQpvcHRpb25zKHdpZHRoPTEwMCkKa25pdHI6Om9wdHNfY2h1bmskc2V0KAogIGV2YWwgPSBGQUxTRSwgIyBydW4gYWxsIGNvZGUKICBlY2hvID0gVFJ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m9yaG9vZF9ncm91cCB2cyBwcmljZQpuYW1lcyhhaXJibmIpCmdsaW1wc2UoYWlyYm5iKQoKbXlfZGF0YSA8LSBOVUxMCnggPC0gTlVMTAp5IDwtIE5VTEwKY29sb3VyIDwtIE5VTEwKc2hhcGUgPC0gTlVMTApzdHJva2UgPC0gTlVMTApgYGAKCmBgYHtyLCBlY2hvPUZ9CmdncGxvdChkYXRhID0gbXlfZGF0YSkgKyAKICBnZW9tX3BvaW50KG1hcHBpbmcgPSBhZXMoeCA9IHgsIHkgPSB5LCBjb2xvdXIgPSBjb2xvdXIpLCBzaGFwZSA9IHNoYXBlLCBzdHJva2UgPSBzdHJva2UpCmBgYAoKPCEtLSBlbmQgYm9keSAtLT4KPCEtLSBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fIC0tPgo8IS0tIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18gLS0+CjwhLS0gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXyAtLT4KCiAgIAo=</div>
</div>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open')
});
});
</script>
<!-- code folding -->
<script>
$(document).ready(function () {
window.initializeSourceEmbed("Lesson1.Rmd");
window.initializeCodeFolding("show" === "show");
});
</script>
<script>
$(document).ready(function () {
// move toc-ignore selectors from section div to header
$('div.section.toc-ignore')
.removeClass('toc-ignore')
.children('h1,h2,h3,h4,h5').addClass('toc-ignore');
// establish options
var options = {
selectors: "h1,h2",
theme: "bootstrap3",
context: '.toc-content',
hashGenerator: function (text) {
return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_');
},
ignoreSelector: ".toc-ignore",
scrollTo: 0
};
options.showAndHide = true;
options.smoothScroll = true;
// tocify
var toc = $("#TOC").tocify(options).data("toc-tocify");
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>