forked from rstudio-conf-2020/r-for-excel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub.html
889 lines (842 loc) · 74.1 KB
/
github.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
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Chapter 4 GitHub | R for Excel Users</title>
<meta name="description" content="This is a workshop for RStudio::conf(2020) in San Francisco, California" />
<meta name="generator" content="bookdown 0.21 and GitBook 2.6.7" />
<meta property="og:title" content="Chapter 4 GitHub | R for Excel Users" />
<meta property="og:type" content="book" />
<meta property="og:description" content="This is a workshop for RStudio::conf(2020) in San Francisco, California" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Chapter 4 GitHub | R for Excel Users" />
<meta name="twitter:description" content="This is a workshop for RStudio::conf(2020) in San Francisco, California" />
<meta name="author" content="Julie Lowndes & Allison Horst" />
<meta name="date" content="2021-01-08" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="prev" href="rstudio.html"/>
<link rel="next" href="ggplot2.html"/>
<script src="libs/header-attrs-2.6/header-attrs.js"></script>
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />
<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li><a href="./">R for Excel Users</a></li>
<li><a href="https://github.com/rstudio-conf-2020/r-for-excel/">← Go to GitHub repo</a></li>
<li class="divider"></li>
<li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Welcome</a>
<ul>
<li class="chapter" data-level="1.1" data-path="index.html"><a href="index.html#agenda"><i class="fa fa-check"></i><b>1.1</b> Agenda</a></li>
<li class="chapter" data-level="1.2" data-path="index.html"><a href="index.html#prerequisites"><i class="fa fa-check"></i><b>1.2</b> Prerequisites</a></li>
<li class="chapter" data-level="1.3" data-path="index.html"><a href="index.html#data-citations"><i class="fa fa-check"></i><b>1.3</b> Data citations</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="overview.html"><a href="overview.html"><i class="fa fa-check"></i><b>2</b> Overview</a>
<ul>
<li class="chapter" data-level="2.1" data-path="overview.html"><a href="overview.html#welcome-1"><i class="fa fa-check"></i><b>2.1</b> Welcome!</a>
<ul>
<li class="chapter" data-level="2.1.1" data-path="overview.html"><a href="overview.html#you-are-all-welcome-here"><i class="fa fa-check"></i><b>2.1.1</b> You are all welcome here</a></li>
</ul></li>
<li class="chapter" data-level="2.2" data-path="overview.html"><a href="overview.html#guiding-principles-recurring-themes"><i class="fa fa-check"></i><b>2.2</b> Guiding principles / recurring themes</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="rstudio.html"><a href="rstudio.html"><i class="fa fa-check"></i><b>3</b> R & RStudio, RMarkdown</a>
<ul>
<li class="chapter" data-level="3.1" data-path="rstudio.html"><a href="rstudio.html#summary"><i class="fa fa-check"></i><b>3.1</b> Summary</a>
<ul>
<li class="chapter" data-level="3.1.1" data-path="rstudio.html"><a href="rstudio.html#objectives"><i class="fa fa-check"></i><b>3.1.1</b> Objectives</a></li>
<li class="chapter" data-level="3.1.2" data-path="rstudio.html"><a href="rstudio.html#resources"><i class="fa fa-check"></i><b>3.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="rstudio.html"><a href="rstudio.html#rstudio-orientation"><i class="fa fa-check"></i><b>3.2</b> RStudio Orientation</a></li>
<li class="chapter" data-level="3.3" data-path="rstudio.html"><a href="rstudio.html#intro-to-rmarkdown"><i class="fa fa-check"></i><b>3.3</b> Intro to RMarkdown</a>
<ul>
<li class="chapter" data-level="3.3.1" data-path="rstudio.html"><a href="rstudio.html#create-an-rmarkdown-file"><i class="fa fa-check"></i><b>3.3.1</b> Create an RMarkdown file</a></li>
<li class="chapter" data-level="3.3.2" data-path="rstudio.html"><a href="rstudio.html#knit-your-rmarkdown-file"><i class="fa fa-check"></i><b>3.3.2</b> Knit your RMarkdown file</a></li>
<li class="chapter" data-level="3.3.3" data-path="rstudio.html"><a href="rstudio.html#markdown-text"><i class="fa fa-check"></i><b>3.3.3</b> Markdown text</a></li>
<li class="chapter" data-level="3.3.4" data-path="rstudio.html"><a href="rstudio.html#r-code"><i class="fa fa-check"></i><b>3.3.4</b> R code</a></li>
<li class="chapter" data-level="3.3.5" data-path="rstudio.html"><a href="rstudio.html#code-chunks"><i class="fa fa-check"></i><b>3.3.5</b> Code chunks</a></li>
</ul></li>
<li class="chapter" data-level="3.4" data-path="rstudio.html"><a href="rstudio.html#r-code-in-the-console"><i class="fa fa-check"></i><b>3.4</b> R code in the Console</a>
<ul>
<li class="chapter" data-level="3.4.1" data-path="rstudio.html"><a href="rstudio.html#error-messages"><i class="fa fa-check"></i><b>3.4.1</b> Error messages</a></li>
<li class="chapter" data-level="3.4.2" data-path="rstudio.html"><a href="rstudio.html#running-rmarkdown-code-chunks"><i class="fa fa-check"></i><b>3.4.2</b> Running RMarkdown code chunks</a></li>
<li class="chapter" data-level="3.4.3" data-path="rstudio.html"><a href="rstudio.html#writing-code-in-a-file-vs.-console"><i class="fa fa-check"></i><b>3.4.3</b> Writing code in a file vs. Console</a></li>
</ul></li>
<li class="chapter" data-level="3.5" data-path="rstudio.html"><a href="rstudio.html#r-functions"><i class="fa fa-check"></i><b>3.5</b> R functions</a></li>
<li class="chapter" data-level="3.6" data-path="rstudio.html"><a href="rstudio.html#help-pages"><i class="fa fa-check"></i><b>3.6</b> Help pages</a></li>
<li class="chapter" data-level="3.7" data-path="rstudio.html"><a href="rstudio.html#commenting"><i class="fa fa-check"></i><b>3.7</b> Commenting</a></li>
<li class="chapter" data-level="3.8" data-path="rstudio.html"><a href="rstudio.html#assigning-objects-with--"><i class="fa fa-check"></i><b>3.8</b> Assigning objects with <code><-</code></a></li>
<li class="chapter" data-level="3.9" data-path="rstudio.html"><a href="rstudio.html#r-packages"><i class="fa fa-check"></i><b>3.9</b> R Packages</a>
<ul>
<li class="chapter" data-level="3.9.1" data-path="rstudio.html"><a href="rstudio.html#how-do-you-know-what-packagesfunctions-exist"><i class="fa fa-check"></i><b>3.9.1</b> How do you know what packages/functions exist?</a></li>
<li class="chapter" data-level="3.9.2" data-path="rstudio.html"><a href="rstudio.html#installing-r-packages"><i class="fa fa-check"></i><b>3.9.2</b> Installing R Packages</a></li>
</ul></li>
<li class="chapter" data-level="3.10" data-path="rstudio.html"><a href="rstudio.html#github-brief-intro-config"><i class="fa fa-check"></i><b>3.10</b> GitHub brief intro & config</a>
<ul>
<li class="chapter" data-level="3.10.1" data-path="rstudio.html"><a href="rstudio.html#configure-github"><i class="fa fa-check"></i><b>3.10.1</b> Configure GitHub</a></li>
<li class="chapter" data-level="3.10.2" data-path="rstudio.html"><a href="rstudio.html#ensure-that-gitgithubrstudio-are-communicating"><i class="fa fa-check"></i><b>3.10.2</b> Ensure that Git/GitHub/RStudio are communicating</a></li>
<li class="chapter" data-level="3.10.3" data-path="rstudio.html"><a href="rstudio.html#troubleshooting"><i class="fa fa-check"></i><b>3.10.3</b> Troubleshooting</a></li>
<li class="chapter" data-level="3.10.4" data-path="rstudio.html"><a href="rstudio.html#end-rstudiormarkdown-session"><i class="fa fa-check"></i><b>3.10.4</b> END <strong>RStudio/RMarkdown</strong> session!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="4" data-path="github.html"><a href="github.html"><i class="fa fa-check"></i><b>4</b> GitHub</a>
<ul>
<li class="chapter" data-level="4.1" data-path="github.html"><a href="github.html#summary-1"><i class="fa fa-check"></i><b>4.1</b> Summary</a>
<ul>
<li class="chapter" data-level="4.1.1" data-path="github.html"><a href="github.html#objectives-1"><i class="fa fa-check"></i><b>4.1.1</b> Objectives</a></li>
<li class="chapter" data-level="4.1.2" data-path="github.html"><a href="github.html#resources-1"><i class="fa fa-check"></i><b>4.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="4.2" data-path="github.html"><a href="github.html#why-should-r-users-use-github"><i class="fa fa-check"></i><b>4.2</b> Why should R users use Github?</a>
<ul>
<li class="chapter" data-level="4.2.1" data-path="github.html"><a href="github.html#what-is-github-and-git"><i class="fa fa-check"></i><b>4.2.1</b> What is Github? And Git?</a></li>
</ul></li>
<li class="chapter" data-level="4.3" data-path="github.html"><a href="github.html#github-configuration"><i class="fa fa-check"></i><b>4.3</b> Github Configuration</a></li>
<li class="chapter" data-level="4.4" data-path="github.html"><a href="github.html#create-a-repository-on-github.com"><i class="fa fa-check"></i><b>4.4</b> Create a repository on Github.com</a></li>
<li class="chapter" data-level="4.5" data-path="github.html"><a href="github.html#clone-your-repository-using-rstudio"><i class="fa fa-check"></i><b>4.5</b> Clone your repository using RStudio</a>
<ul>
<li class="chapter" data-level="4.5.1" data-path="github.html"><a href="github.html#copy-the-repo-address"><i class="fa fa-check"></i><b>4.5.1</b> Copy the repo address</a></li>
<li class="chapter" data-level="4.5.2" data-path="github.html"><a href="github.html#rstudio-new-project-1"><i class="fa fa-check"></i><b>4.5.2</b> RStudio: New Project</a></li>
<li class="chapter" data-level="4.5.3" data-path="github.html"><a href="github.html#select-version-control-1"><i class="fa fa-check"></i><b>4.5.3</b> Select Version Control</a></li>
<li class="chapter" data-level="4.5.4" data-path="github.html"><a href="github.html#select-git-1"><i class="fa fa-check"></i><b>4.5.4</b> Select Git</a></li>
<li class="chapter" data-level="4.5.5" data-path="github.html"><a href="github.html#paste-the-repo-address"><i class="fa fa-check"></i><b>4.5.5</b> Paste the repo address</a></li>
<li class="chapter" data-level="4.5.6" data-path="github.html"><a href="github.html#admire-your-local-repo"><i class="fa fa-check"></i><b>4.5.6</b> Admire your local repo</a></li>
<li class="chapter" data-level="4.5.7" data-path="github.html"><a href="github.html#inspect-your-local-repo"><i class="fa fa-check"></i><b>4.5.7</b> Inspect your local repo</a></li>
<li class="chapter" data-level="4.5.8" data-path="github.html"><a href="github.html#edit-your-readme-file"><i class="fa fa-check"></i><b>4.5.8</b> Edit your README file</a></li>
</ul></li>
<li class="chapter" data-level="4.6" data-path="github.html"><a href="github.html#sync-from-rstudio-local-to-github-remote"><i class="fa fa-check"></i><b>4.6</b> Sync from RStudio (local) to GitHub (remote)</a>
<ul>
<li class="chapter" data-level="4.6.1" data-path="github.html"><a href="github.html#pull"><i class="fa fa-check"></i><b>4.6.1</b> Pull</a></li>
<li class="chapter" data-level="4.6.2" data-path="github.html"><a href="github.html#stage"><i class="fa fa-check"></i><b>4.6.2</b> Stage</a></li>
<li class="chapter" data-level="4.6.3" data-path="github.html"><a href="github.html#commit"><i class="fa fa-check"></i><b>4.6.3</b> Commit</a></li>
<li class="chapter" data-level="4.6.4" data-path="github.html"><a href="github.html#push"><i class="fa fa-check"></i><b>4.6.4</b> Push</a></li>
</ul></li>
<li class="chapter" data-level="4.7" data-path="github.html"><a href="github.html#commit-history"><i class="fa fa-check"></i><b>4.7</b> Commit history</a></li>
<li class="chapter" data-level="4.8" data-path="github.html"><a href="github.html#project-oriented-workflows"><i class="fa fa-check"></i><b>4.8</b> Project-oriented workflows</a>
<ul>
<li class="chapter" data-level="4.8.1" data-path="github.html"><a href="github.html#working-directory"><i class="fa fa-check"></i><b>4.8.1</b> Working directory</a></li>
</ul></li>
<li class="chapter" data-level="4.9" data-path="github.html"><a href="github.html#project-oriented-workflows-in-action-aka-our-analytical-setup"><i class="fa fa-check"></i><b>4.9</b> Project-oriented workflows in action (aka our analytical setup)</a>
<ul>
<li class="chapter" data-level="4.9.1" data-path="github.html"><a href="github.html#create-a-new-rmd-file"><i class="fa fa-check"></i><b>4.9.1</b> Create a new Rmd file</a></li>
<li class="chapter" data-level="4.9.2" data-path="github.html"><a href="github.html#create-data-and-figures-folders"><i class="fa fa-check"></i><b>4.9.2</b> Create data and figures folders</a></li>
<li class="chapter" data-level="4.9.3" data-path="github.html"><a href="github.html#move-data-files-to-data-folder"><i class="fa fa-check"></i><b>4.9.3</b> Move data files to data folder</a></li>
<li class="chapter" data-level="4.9.4" data-path="github.html"><a href="github.html#activity-1"><i class="fa fa-check"></i><b>4.9.4</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="4.10" data-path="github.html"><a href="github.html#committing---how-often-tracking-changes-in-your-files"><i class="fa fa-check"></i><b>4.10</b> Committing - how often? Tracking changes in your files</a></li>
<li class="chapter" data-level="4.11" data-path="github.html"><a href="github.html#issues"><i class="fa fa-check"></i><b>4.11</b> Issues</a>
<ul>
<li class="chapter" data-level="4.11.1" data-path="github.html"><a href="github.html#issues-in-the-wild"><i class="fa fa-check"></i><b>4.11.1</b> Issues in the wild!</a></li>
<li class="chapter" data-level="4.11.2" data-path="github.html"><a href="github.html#end-github-session"><i class="fa fa-check"></i><b>4.11.2</b> END <strong>GitHub</strong> session!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="5" data-path="ggplot2.html"><a href="ggplot2.html"><i class="fa fa-check"></i><b>5</b> Graphs with ggplot2</a>
<ul>
<li class="chapter" data-level="5.1" data-path="ggplot2.html"><a href="ggplot2.html#summary-2"><i class="fa fa-check"></i><b>5.1</b> Summary</a>
<ul>
<li class="chapter" data-level="5.1.1" data-path="ggplot2.html"><a href="ggplot2.html#objectives-2"><i class="fa fa-check"></i><b>5.1.1</b> Objectives</a></li>
<li class="chapter" data-level="5.1.2" data-path="ggplot2.html"><a href="ggplot2.html#resources-2"><i class="fa fa-check"></i><b>5.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="5.2" data-path="ggplot2.html"><a href="ggplot2.html#getting-started---in-existing-.rmd-attach-packages"><i class="fa fa-check"></i><b>5.2</b> Getting started - In existing .Rmd, attach packages</a></li>
<li class="chapter" data-level="5.3" data-path="ggplot2.html"><a href="ggplot2.html#read-in-.xlsx-and-.csv-files"><i class="fa fa-check"></i><b>5.3</b> Read in .xlsx and .csv files</a>
<ul>
<li class="chapter" data-level="5.3.1" data-path="ggplot2.html"><a href="ggplot2.html#read_csv-to-read-in-comma-separated-value-.csv-files"><i class="fa fa-check"></i><b>5.3.1</b> <code>read_csv()</code> to read in comma-separated-value (.csv) files</a></li>
<li class="chapter" data-level="5.3.2" data-path="ggplot2.html"><a href="ggplot2.html#readxl-to-read-in-excel-files"><i class="fa fa-check"></i><b>5.3.2</b> <code>readxl</code> to read in Excel files</a></li>
</ul></li>
<li class="chapter" data-level="5.4" data-path="ggplot2.html"><a href="ggplot2.html#our-first-ggplot-graph-visitors-to-channel-islands-np"><i class="fa fa-check"></i><b>5.4</b> Our first ggplot graph: Visitors to Channel Islands NP</a></li>
<li class="chapter" data-level="5.5" data-path="ggplot2.html"><a href="ggplot2.html#intro-to-customizing-ggplot-graphs"><i class="fa fa-check"></i><b>5.5</b> Intro to customizing <code>ggplot</code> graphs</a>
<ul>
<li class="chapter" data-level="5.5.1" data-path="ggplot2.html"><a href="ggplot2.html#activity-customize-your-own-ggplot-graph"><i class="fa fa-check"></i><b>5.5.1</b> Activity: customize your own ggplot graph</a></li>
</ul></li>
<li class="chapter" data-level="5.6" data-path="ggplot2.html"><a href="ggplot2.html#mapping-variables-onto-aesthetics"><i class="fa fa-check"></i><b>5.6</b> Mapping variables onto aesthetics</a>
<ul>
<li class="chapter" data-level="5.6.1" data-path="ggplot2.html"><a href="ggplot2.html#activity-map-variables-onto-graph-aesthetics"><i class="fa fa-check"></i><b>5.6.1</b> Activity: map variables onto graph aesthetics</a></li>
</ul></li>
<li class="chapter" data-level="5.7" data-path="ggplot2.html"><a href="ggplot2.html#ggplot2-complete-themes"><i class="fa fa-check"></i><b>5.7</b> ggplot2 complete themes</a></li>
<li class="chapter" data-level="5.8" data-path="ggplot2.html"><a href="ggplot2.html#updating-axis-labels-and-titles"><i class="fa fa-check"></i><b>5.8</b> Updating axis labels and titles</a></li>
<li class="chapter" data-level="5.9" data-path="ggplot2.html"><a href="ggplot2.html#combining-compatible-geoms"><i class="fa fa-check"></i><b>5.9</b> Combining compatible geoms</a></li>
<li class="chapter" data-level="5.10" data-path="ggplot2.html"><a href="ggplot2.html#multi-series-ggplot-graphs"><i class="fa fa-check"></i><b>5.10</b> Multi-series ggplot graphs</a></li>
<li class="chapter" data-level="5.11" data-path="ggplot2.html"><a href="ggplot2.html#faceting-ggplot-graphs"><i class="fa fa-check"></i><b>5.11</b> Faceting ggplot graphs</a></li>
<li class="chapter" data-level="5.12" data-path="ggplot2.html"><a href="ggplot2.html#exporting-a-ggplot-graph-with-ggsave"><i class="fa fa-check"></i><b>5.12</b> Exporting a ggplot graph with <code>ggsave()</code></a>
<ul>
<li class="chapter" data-level="5.12.1" data-path="ggplot2.html"><a href="ggplot2.html#end-ggplot-session"><i class="fa fa-check"></i><b>5.12.1</b> End <code>ggplot</code> session!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="6" data-path="pivot-tables.html"><a href="pivot-tables.html"><i class="fa fa-check"></i><b>6</b> Pivot Tables with <code>dplyr</code></a>
<ul>
<li class="chapter" data-level="6.1" data-path="pivot-tables.html"><a href="pivot-tables.html#summary-3"><i class="fa fa-check"></i><b>6.1</b> Summary</a>
<ul>
<li class="chapter" data-level="6.1.1" data-path="pivot-tables.html"><a href="pivot-tables.html#objectives-3"><i class="fa fa-check"></i><b>6.1.1</b> Objectives</a></li>
<li class="chapter" data-level="6.1.2" data-path="pivot-tables.html"><a href="pivot-tables.html#resources-3"><i class="fa fa-check"></i><b>6.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="6.2" data-path="pivot-tables.html"><a href="pivot-tables.html#overview-setup"><i class="fa fa-check"></i><b>6.2</b> Overview & setup</a>
<ul>
<li class="chapter" data-level="6.2.1" data-path="pivot-tables.html"><a href="pivot-tables.html#view-data-in-excel"><i class="fa fa-check"></i><b>6.2.1</b> View data in Excel</a></li>
<li class="chapter" data-level="6.2.2" data-path="pivot-tables.html"><a href="pivot-tables.html#rmarkdown-setup"><i class="fa fa-check"></i><b>6.2.2</b> RMarkdown setup</a></li>
<li class="chapter" data-level="6.2.3" data-path="pivot-tables.html"><a href="pivot-tables.html#our-task"><i class="fa fa-check"></i><b>6.2.3</b> Our task</a></li>
</ul></li>
<li class="chapter" data-level="6.3" data-path="pivot-tables.html"><a href="pivot-tables.html#pivot-table-demo"><i class="fa fa-check"></i><b>6.3</b> Pivot table demo</a>
<ul>
<li class="chapter" data-level="6.3.1" data-path="pivot-tables.html"><a href="pivot-tables.html#pivot-one-variable"><i class="fa fa-check"></i><b>6.3.1</b> pivot one variable</a></li>
<li class="chapter" data-level="6.3.2" data-path="pivot-tables.html"><a href="pivot-tables.html#pivot-two-variables"><i class="fa fa-check"></i><b>6.3.2</b> pivot two variables</a></li>
</ul></li>
<li class="chapter" data-level="6.4" data-path="pivot-tables.html"><a href="pivot-tables.html#group_by-summarize"><i class="fa fa-check"></i><b>6.4</b> <code>group_by()</code> %>% <code>summarize()</code></a>
<ul>
<li class="chapter" data-level="6.4.1" data-path="pivot-tables.html"><a href="pivot-tables.html#group_by-one-variable"><i class="fa fa-check"></i><b>6.4.1</b> <code>group_by</code> one variable</a></li>
<li class="chapter" data-level="6.4.2" data-path="pivot-tables.html"><a href="pivot-tables.html#group_by-multiple-variables"><i class="fa fa-check"></i><b>6.4.2</b> <code>group_by</code> multiple variables</a></li>
<li class="chapter" data-level="6.4.3" data-path="pivot-tables.html"><a href="pivot-tables.html#summarize-multiple-variables"><i class="fa fa-check"></i><b>6.4.3</b> <code>summarize</code> multiple variables</a></li>
<li class="chapter" data-level="6.4.4" data-path="pivot-tables.html"><a href="pivot-tables.html#table-formatting-with-kable"><i class="fa fa-check"></i><b>6.4.4</b> Table formatting with <code>kable()</code></a></li>
<li class="chapter" data-level="6.4.5" data-path="pivot-tables.html"><a href="pivot-tables.html#r-code-in-line-in-rmarkdown"><i class="fa fa-check"></i><b>6.4.5</b> R code in-line in RMarkdown</a></li>
<li class="chapter" data-level="6.4.6" data-path="pivot-tables.html"><a href="pivot-tables.html#activity-2"><i class="fa fa-check"></i><b>6.4.6</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="6.5" data-path="pivot-tables.html"><a href="pivot-tables.html#oh-no-they-sent-the-wrong-data"><i class="fa fa-check"></i><b>6.5</b> Oh no, they sent the wrong data!</a>
<ul>
<li class="chapter" data-level="6.5.1" data-path="pivot-tables.html"><a href="pivot-tables.html#knit-push-show-differences-on-github"><i class="fa fa-check"></i><b>6.5.1</b> Knit, push, & show differences on GitHub</a></li>
<li class="chapter" data-level="6.5.2" data-path="pivot-tables.html"><a href="pivot-tables.html#dplyrcount"><i class="fa fa-check"></i><b>6.5.2</b> <code>dplyr::count()</code></a></li>
</ul></li>
<li class="chapter" data-level="6.6" data-path="pivot-tables.html"><a href="pivot-tables.html#mutate"><i class="fa fa-check"></i><b>6.6</b> <code>mutate()</code></a></li>
<li class="chapter" data-level="6.7" data-path="pivot-tables.html"><a href="pivot-tables.html#select"><i class="fa fa-check"></i><b>6.7</b> <code>select()</code></a>
<ul>
<li class="chapter" data-level="6.7.1" data-path="pivot-tables.html"><a href="pivot-tables.html#end-dplyr-pivot-tables-session"><i class="fa fa-check"></i><b>6.7.1</b> END <strong>dplyr-pivot-tables</strong> session!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="7" data-path="tidying.html"><a href="tidying.html"><i class="fa fa-check"></i><b>7</b> Tidying</a>
<ul>
<li class="chapter" data-level="7.1" data-path="tidying.html"><a href="tidying.html#summary-4"><i class="fa fa-check"></i><b>7.1</b> Summary</a>
<ul>
<li class="chapter" data-level="7.1.1" data-path="tidying.html"><a href="tidying.html#tidy-data"><i class="fa fa-check"></i><b>7.1.1</b> Tidy data</a></li>
<li class="chapter" data-level="7.1.2" data-path="tidying.html"><a href="tidying.html#objectives-4"><i class="fa fa-check"></i><b>7.1.2</b> Objectives</a></li>
<li class="chapter" data-level="7.1.3" data-path="tidying.html"><a href="tidying.html#resources-4"><i class="fa fa-check"></i><b>7.1.3</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="7.2" data-path="tidying.html"><a href="tidying.html#set-up"><i class="fa fa-check"></i><b>7.2</b> Set-up</a>
<ul>
<li class="chapter" data-level="7.2.1" data-path="tidying.html"><a href="tidying.html#create-a-new-r-markdown-and-attach-packages"><i class="fa fa-check"></i><b>7.2.1</b> Create a new R Markdown and attach packages</a></li>
<li class="chapter" data-level="7.2.2" data-path="tidying.html"><a href="tidying.html#read_excel-to-read-in-data-from-an-excel-worksheet"><i class="fa fa-check"></i><b>7.2.2</b> <code>read_excel()</code> to read in data from an Excel worksheet</a></li>
</ul></li>
<li class="chapter" data-level="7.3" data-path="tidying.html"><a href="tidying.html#tidyrpivot_longer-to-reshape-from-wider-to-longer-format"><i class="fa fa-check"></i><b>7.3</b> <code>tidyr::pivot_longer()</code> to reshape from wider-to-longer format</a></li>
<li class="chapter" data-level="7.4" data-path="tidying.html"><a href="tidying.html#tidyrpivot_wider-to-convert-from-longer-to-wider-format"><i class="fa fa-check"></i><b>7.4</b> <code>tidyr::pivot_wider()</code> to convert from longer-to-wider format</a></li>
<li class="chapter" data-level="7.5" data-path="tidying.html"><a href="tidying.html#janitorclean_names-to-clean-up-column-names"><i class="fa fa-check"></i><b>7.5</b> <code>janitor::clean_names()</code> to clean up column names</a></li>
<li class="chapter" data-level="7.6" data-path="tidying.html"><a href="tidying.html#tidyrunite-and-tidyrseparate-to-combine-or-separate-information-in-columns"><i class="fa fa-check"></i><b>7.6</b> <code>tidyr::unite()</code> and <code>tidyr::separate()</code> to combine or separate information in column(s)</a>
<ul>
<li class="chapter" data-level="7.6.1" data-path="tidying.html"><a href="tidying.html#tidyrunite-to-merge-information-from-separate-columns"><i class="fa fa-check"></i><b>7.6.1</b> <code>tidyr::unite()</code> to merge information from separate columns</a></li>
<li class="chapter" data-level="7.6.2" data-path="tidying.html"><a href="tidying.html#tidyrseparate-to-separate-information-into-multiple-columns"><i class="fa fa-check"></i><b>7.6.2</b> <code>tidyr::separate()</code> to separate information into multiple columns</a></li>
</ul></li>
<li class="chapter" data-level="7.7" data-path="tidying.html"><a href="tidying.html#stringrstr_replace-to-replace-a-pattern"><i class="fa fa-check"></i><b>7.7</b> <code>stringr::str_replace()</code> to replace a pattern</a>
<ul>
<li class="chapter" data-level="7.7.1" data-path="tidying.html"><a href="tidying.html#end-tidying-session"><i class="fa fa-check"></i><b>7.7.1</b> END <strong>tidying</strong> session!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="8" data-path="filter-join.html"><a href="filter-join.html"><i class="fa fa-check"></i><b>8</b> Filters and joins</a>
<ul>
<li class="chapter" data-level="8.1" data-path="filter-join.html"><a href="filter-join.html#summary-5"><i class="fa fa-check"></i><b>8.1</b> Summary</a>
<ul>
<li class="chapter" data-level="8.1.1" data-path="filter-join.html"><a href="filter-join.html#objectives-5"><i class="fa fa-check"></i><b>8.1.1</b> Objectives</a></li>
<li class="chapter" data-level="8.1.2" data-path="filter-join.html"><a href="filter-join.html#resources-5"><i class="fa fa-check"></i><b>8.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="8.2" data-path="filter-join.html"><a href="filter-join.html#set-up-create-a-new-.rmd-attach-packages-get-data"><i class="fa fa-check"></i><b>8.2</b> Set-up: Create a new .Rmd, attach packages & get data</a></li>
<li class="chapter" data-level="8.3" data-path="filter-join.html"><a href="filter-join.html#dplyrfilter-to-conditionally-subset-by-rows"><i class="fa fa-check"></i><b>8.3</b> <code>dplyr::filter()</code> to conditionally subset by rows</a>
<ul>
<li class="chapter" data-level="8.3.1" data-path="filter-join.html"><a href="filter-join.html#filter-rows-by-matching-a-single-character-string"><i class="fa fa-check"></i><b>8.3.1</b> Filter rows by matching a single character string</a></li>
<li class="chapter" data-level="8.3.2" data-path="filter-join.html"><a href="filter-join.html#filter-rows-based-on-numeric-conditions"><i class="fa fa-check"></i><b>8.3.2</b> Filter rows based on numeric conditions</a></li>
<li class="chapter" data-level="8.3.3" data-path="filter-join.html"><a href="filter-join.html#filter-to-return-rows-that-match-this-or-that-or-that"><i class="fa fa-check"></i><b>8.3.3</b> Filter to return rows that match <em>this</em> OR <em>that</em> OR <em>that</em></a></li>
<li class="chapter" data-level="8.3.4" data-path="filter-join.html"><a href="filter-join.html#filter-to-return-observations-that-match-this-and-that"><i class="fa fa-check"></i><b>8.3.4</b> Filter to return observations that match <strong>this</strong> AND <strong>that</strong></a></li>
<li class="chapter" data-level="8.3.5" data-path="filter-join.html"><a href="filter-join.html#activity-combined-filter-conditions"><i class="fa fa-check"></i><b>8.3.5</b> Activity: combined filter conditions</a></li>
<li class="chapter" data-level="8.3.6" data-path="filter-join.html"><a href="filter-join.html#stringrstr_detect-to-filter-by-a-partial-pattern"><i class="fa fa-check"></i><b>8.3.6</b> <code>stringr::str_detect()</code> to filter by a partial pattern</a></li>
<li class="chapter" data-level="8.3.7" data-path="filter-join.html"><a href="filter-join.html#activity-6"><i class="fa fa-check"></i><b>8.3.7</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="8.4" data-path="filter-join.html"><a href="filter-join.html#dplyr_join-to-merge-data-frames"><i class="fa fa-check"></i><b>8.4</b> <code>dplyr::*_join()</code> to merge data frames</a>
<ul>
<li class="chapter" data-level="8.4.1" data-path="filter-join.html"><a href="filter-join.html#full_join-to-merge-data-frames-keeping-everything"><i class="fa fa-check"></i><b>8.4.1</b> <code>full_join()</code> to merge data frames, keeping everything</a></li>
<li class="chapter" data-level="8.4.2" data-path="filter-join.html"><a href="filter-join.html#left_joinxy-to-merge-data-frames-keeping-everything-in-the-x-data-frame-and-only-matches-from-the-y-data-frame"><i class="fa fa-check"></i><b>8.4.2</b> <code>left_join(x,y)</code> to merge data frames, keeping everything in the ‘x’ data frame and only matches from the ‘y’ data frame</a></li>
<li class="chapter" data-level="8.4.3" data-path="filter-join.html"><a href="filter-join.html#inner_join-to-merge-data-frames-only-keeping-observations-with-a-match-in-both"><i class="fa fa-check"></i><b>8.4.3</b> <code>inner_join()</code> to merge data frames, only keeping observations with a match in <strong>both</strong></a></li>
<li class="chapter" data-level="8.4.4" data-path="filter-join.html"><a href="filter-join.html#filter-and-join-in-a-sequence"><i class="fa fa-check"></i><b>8.4.4</b> <code>filter()</code> and <code>join()</code> in a sequence</a></li>
</ul></li>
<li class="chapter" data-level="8.5" data-path="filter-join.html"><a href="filter-join.html#an-html-table-with-kable-and-kableextra"><i class="fa fa-check"></i><b>8.5</b> An HTML table with <code>kable()</code> and <code>kableExtra</code></a>
<ul>
<li class="chapter" data-level="8.5.1" data-path="filter-join.html"><a href="filter-join.html#end-filter-_join-section"><i class="fa fa-check"></i><b>8.5.1</b> End <code>filter()</code> + <code>_join()</code> section!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="9" data-path="collaborating.html"><a href="collaborating.html"><i class="fa fa-check"></i><b>9</b> Collaborating & getting help</a>
<ul>
<li class="chapter" data-level="9.1" data-path="collaborating.html"><a href="collaborating.html#summary-6"><i class="fa fa-check"></i><b>9.1</b> Summary</a>
<ul>
<li class="chapter" data-level="9.1.1" data-path="collaborating.html"><a href="collaborating.html#objectives-6"><i class="fa fa-check"></i><b>9.1.1</b> Objectives</a></li>
<li class="chapter" data-level="9.1.2" data-path="collaborating.html"><a href="collaborating.html#resources-6"><i class="fa fa-check"></i><b>9.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="9.2" data-path="collaborating.html"><a href="collaborating.html#r-communities"><i class="fa fa-check"></i><b>9.2</b> R communities</a>
<ul>
<li class="chapter" data-level="9.2.1" data-path="collaborating.html"><a href="collaborating.html#community-awesomeness"><i class="fa fa-check"></i><b>9.2.1</b> Community awesomeness</a></li>
</ul></li>
<li class="chapter" data-level="9.3" data-path="collaborating.html"><a href="collaborating.html#how-to-use-twitter-for-rstats"><i class="fa fa-check"></i><b>9.3</b> How to use Twitter for #rstats</a>
<ul>
<li class="chapter" data-level="9.3.1" data-path="collaborating.html"><a href="collaborating.html#examples"><i class="fa fa-check"></i><b>9.3.1</b> Examples</a></li>
<li class="chapter" data-level="9.3.2" data-path="collaborating.html"><a href="collaborating.html#how-to-twitter"><i class="fa fa-check"></i><b>9.3.2</b> How to Twitter</a></li>
</ul></li>
<li class="chapter" data-level="9.4" data-path="collaborating.html"><a href="collaborating.html#getting-help"><i class="fa fa-check"></i><b>9.4</b> Getting help</a>
<ul>
<li class="chapter" data-level="9.4.1" data-path="collaborating.html"><a href="collaborating.html#read-the-error-message"><i class="fa fa-check"></i><b>9.4.1</b> Read the error message</a></li>
<li class="chapter" data-level="9.4.2" data-path="collaborating.html"><a href="collaborating.html#googling"><i class="fa fa-check"></i><b>9.4.2</b> Googling</a></li>
<li class="chapter" data-level="9.4.3" data-path="collaborating.html"><a href="collaborating.html#create-a-reprex"><i class="fa fa-check"></i><b>9.4.3</b> Create a reprex</a></li>
<li class="chapter" data-level="9.4.4" data-path="collaborating.html"><a href="collaborating.html#activity-7"><i class="fa fa-check"></i><b>9.4.4</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="9.5" data-path="collaborating.html"><a href="collaborating.html#collaborating-with-github"><i class="fa fa-check"></i><b>9.5</b> Collaborating with GitHub</a>
<ul>
<li class="chapter" data-level="9.5.1" data-path="collaborating.html"><a href="collaborating.html#create-repo-partner-1"><i class="fa fa-check"></i><b>9.5.1</b> Create repo (Partner 1)</a></li>
<li class="chapter" data-level="9.5.2" data-path="collaborating.html"><a href="collaborating.html#create-a-gh-pages-branch-partner-1"><i class="fa fa-check"></i><b>9.5.2</b> Create a gh-pages branch (Partner 1)</a></li>
<li class="chapter" data-level="9.5.3" data-path="collaborating.html"><a href="collaborating.html#give-your-collaborator-privileges-partner-1-and-2"><i class="fa fa-check"></i><b>9.5.3</b> Give your collaborator privileges (Partner 1 and 2)</a></li>
<li class="chapter" data-level="9.5.4" data-path="collaborating.html"><a href="collaborating.html#clone-to-a-new-r-project-partner-1"><i class="fa fa-check"></i><b>9.5.4</b> Clone to a new R Project (Partner 1)</a></li>
<li class="chapter" data-level="9.5.5" data-path="collaborating.html"><a href="collaborating.html#clone-to-a-new-r-project-partner-2"><i class="fa fa-check"></i><b>9.5.5</b> Clone to a new R Project (Partner 2)</a></li>
<li class="chapter" data-level="9.5.6" data-path="collaborating.html"><a href="collaborating.html#create-data-folder-partner-2"><i class="fa fa-check"></i><b>9.5.6</b> Create data folder (Partner 2)</a></li>
<li class="chapter" data-level="9.5.7" data-path="collaborating.html"><a href="collaborating.html#state-of-the-repository"><i class="fa fa-check"></i><b>9.5.7</b> State of the Repository</a></li>
</ul></li>
<li class="chapter" data-level="9.6" data-path="collaborating.html"><a href="collaborating.html#merge-conflicts"><i class="fa fa-check"></i><b>9.6</b> Merge conflicts</a>
<ul>
<li class="chapter" data-level="9.6.1" data-path="collaborating.html"><a href="collaborating.html#pull-partners-1-and-2"><i class="fa fa-check"></i><b>9.6.1</b> Pull (Partners 1 and 2)</a></li>
<li class="chapter" data-level="9.6.2" data-path="collaborating.html"><a href="collaborating.html#create-a-conflict-partners-1-and-2"><i class="fa fa-check"></i><b>9.6.2</b> Create a conflict (Partners 1 and 2)</a></li>
<li class="chapter" data-level="9.6.3" data-path="collaborating.html"><a href="collaborating.html#sync-partner-2"><i class="fa fa-check"></i><b>9.6.3</b> Sync (Partner 2)</a></li>
<li class="chapter" data-level="9.6.4" data-path="collaborating.html"><a href="collaborating.html#sync-attempts-fixes-partner-1"><i class="fa fa-check"></i><b>9.6.4</b> Sync attempts & fixes (Partner 1)</a></li>
<li class="chapter" data-level="9.6.5" data-path="collaborating.html"><a href="collaborating.html#activity-8"><i class="fa fa-check"></i><b>9.6.5</b> Activity</a></li>
<li class="chapter" data-level="9.6.6" data-path="collaborating.html"><a href="collaborating.html#how-do-you-avoid-merge-conflicts"><i class="fa fa-check"></i><b>9.6.6</b> How do you avoid merge conflicts?</a></li>
</ul></li>
<li class="chapter" data-level="9.7" data-path="collaborating.html"><a href="collaborating.html#create-your-collaborative-website"><i class="fa fa-check"></i><b>9.7</b> Create your collaborative website</a>
<ul>
<li class="chapter" data-level="9.7.1" data-path="collaborating.html"><a href="collaborating.html#end-collaborating-session"><i class="fa fa-check"></i><b>9.7.1</b> END <strong>collaborating</strong> session!</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="10" data-path="synthesis.html"><a href="synthesis.html"><i class="fa fa-check"></i><b>10</b> Synthesis</a>
<ul>
<li class="chapter" data-level="10.1" data-path="synthesis.html"><a href="synthesis.html#summary-7"><i class="fa fa-check"></i><b>10.1</b> Summary</a>
<ul>
<li class="chapter" data-level="10.1.1" data-path="synthesis.html"><a href="synthesis.html#objectives-7"><i class="fa fa-check"></i><b>10.1.1</b> Objectives</a></li>
<li class="chapter" data-level="10.1.2" data-path="synthesis.html"><a href="synthesis.html#resources-7"><i class="fa fa-check"></i><b>10.1.2</b> Resources</a></li>
</ul></li>
<li class="chapter" data-level="10.2" data-path="synthesis.html"><a href="synthesis.html#attach-packages-read-in-and-explore-the-data"><i class="fa fa-check"></i><b>10.2</b> Attach packages, read in and explore the data</a></li>
<li class="chapter" data-level="10.3" data-path="synthesis.html"><a href="synthesis.html#some-data-cleaning-to-get-salmon-landings-by-species"><i class="fa fa-check"></i><b>10.3</b> Some data cleaning to get salmon landings by species</a></li>
<li class="chapter" data-level="10.4" data-path="synthesis.html"><a href="synthesis.html#find-total-annual-us-value-for-each-salmon-subgroup"><i class="fa fa-check"></i><b>10.4</b> Find total annual US value ($) for each salmon subgroup</a></li>
<li class="chapter" data-level="10.5" data-path="synthesis.html"><a href="synthesis.html#make-a-graph-of-us-commercial-fisheries-value-by-species-over-time-with-ggplot2"><i class="fa fa-check"></i><b>10.5</b> Make a graph of US commercial fisheries value by species over time with <code>ggplot2</code></a></li>
<li class="chapter" data-level="10.6" data-path="synthesis.html"><a href="synthesis.html#built-in-color-palettes"><i class="fa fa-check"></i><b>10.6</b> Built-in color palettes</a></li>
<li class="chapter" data-level="10.7" data-path="synthesis.html"><a href="synthesis.html#sync-with-github-remote"><i class="fa fa-check"></i><b>10.7</b> Sync with GitHub remote</a></li>
<li class="chapter" data-level="10.8" data-path="synthesis.html"><a href="synthesis.html#add-an-image-to-your-partners-document"><i class="fa fa-check"></i><b>10.8</b> Add an image to your partner’s document</a>
<ul>
<li class="chapter" data-level="10.8.1" data-path="synthesis.html"><a href="synthesis.html#end-synthesis-session"><i class="fa fa-check"></i><b>10.8.1</b> End Synthesis session!</a></li>
</ul></li>
</ul></li>
<li class="divider"></li>
<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">R for Excel Users</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="github" class="section level1" number="4">
<h1><span class="header-section-number">Chapter 4</span> GitHub</h1>
<div id="summary-1" class="section level2" number="4.1">
<h2><span class="header-section-number">4.1</span> Summary</h2>
<p>We will learn about version control and practice a workflow with GitHub and RStudio that streamlines working with our most important collaborator: Future You.</p>
<div id="objectives-1" class="section level3" number="4.1.1">
<h3><span class="header-section-number">4.1.1</span> Objectives</h3>
<p>Today, we’ll interface with GitHub from our local computers using RStudio.</p>
<blockquote>
<p><strong>Aside</strong>: There are many other ways to interact with GitHub, including GitHub’s Desktop App and the command line (<a href="http://stat545.com/git02_git-clients.html">here is Jenny Bryan’s list of git clients</a>). You have the largest suite of options if you interface through the command line, but the most common things you’ll do can be done through one of these other applications (i.e. RStudio).</p>
</blockquote>
<p>Here’s what we’ll do, since we’ve already set up git on your computers in the previous session (Chapter <a href="github.html#github">4</a>):</p>
<ol style="list-style-type: decimal">
<li>create a repository on Github.com (remote)</li>
<li>clone locally using RStudio</li>
<li>sync local to remote: pull, stage, commit, push</li>
<li>explore github.com files, commit history, README</li>
<li>project-oriented workflows</li>
<li>project-oriented workflows in action</li>
</ol>
</div>
<div id="resources-1" class="section level3" number="4.1.2">
<h3><span class="header-section-number">4.1.2</span> Resources</h3>
<ul>
<li><a href="https://peerj.com/preprints/3159/">Excuse me, do you have a moment to talk about version control?</a> by Jenny Bryan</li>
<li><a href="http://happygitwithr.com/">Happy Git with R</a> by Jenny Bryan, specifically <a href="http://happygitwithr.com/rstudio-see-git.html">Detect Git from RStudio</a></li>
<li><a href="https://rstats.wtf/">What They Forgot to Teach You About R</a> by Jenny Bryan, specifically <a href="https://rstats.wtf/project-oriented-workflow.html">Project-oriented workflows</a><br />
</li>
<li><a href="https://rawgit.com/nazrug/Quickstart/master/GithubQuickstart.html">GitHub Quickstart</a> by Melanie Frazier</li>
<li><a href="https://openscapes.github.io/series/github-issues.html">GitHub for Project Management</a> by Openscapes</li>
</ul>
</div>
</div>
<div id="why-should-r-users-use-github" class="section level2" number="4.2">
<h2><span class="header-section-number">4.2</span> Why should R users use Github?</h2>
<p>Modern R users use GitHub because it helps make coding collaborative and social while also providing huge benefits to organization, archiving, and being able to find your files easily when you need them.</p>
<p>One of the most compelling reasons for me is that it ends (or nearly ends) the horror of keeping track of versions.</p>
<p>Basically, we get away from this:</p>
<p><br></p>
<p><img src="img/excel_messy_saves.png" width="80%" />
<br></p>
<p>This is a nightmare not only because I have NO idea which is truly the version we used in that analysis we need to update, but because it is going to take a lot of detective work to see what actually changed between each file. Also, it is very sad to think about the amount of time everyone involved is spending on bookkeeping: is everyone downloading an attachment, dragging it to wherever they organize this on their own computers, and then renaming everything? Hours and hours of all of our lives.</p>
<p>But then there is GitHub.</p>
<p>In GitHub, in this example you will likely only see a single file, which is the most recent version. GitHub’s job is to track who made any changes and when (so no need to save a copy with your name or date at the end), and it also requires that you write something human-readable that will be a breadcrumb for you in the future. It is also designed to be easy to compare versions, and you can easily revert to previous versions.</p>
<p>GitHub also supercharges you as a collaborator. First and foremost with Future You, but also sets you up to collaborate with Future Us!</p>
<p>GitHub, especially in combination with RStudio, is also game-changing for publishing and distributing. You can — and we will — publish and share files openly on the internet.</p>
<div id="what-is-github-and-git" class="section level3" number="4.2.1">
<h3><span class="header-section-number">4.2.1</span> What is Github? And Git?</h3>
<p>OK so what is GitHub? And Git?</p>
<ul>
<li><p><strong>Git</strong> is a program that you install on your computer: it is version control software that tracks changes to your files over time.</p></li>
<li><p><strong>Github</strong> is a website that is essentially a social media platform for your git-versioned files. GitHub stores all your versioned files as an archive, but also as allows you to interact with other people’s files and has management tools for the social side of software projects. It has many nice features to be able visualize differences between <a href="https://help.github.com/articles/rendering-and-diffing-images/">images</a>, <a href="https://help.github.com/articles/mapping-geojson-files-on-github/">rendering</a> & <a href="https://github.com/blog/1772-diffable-more-customizable-maps">diffing</a> map data files, <a href="https://help.github.com/articles/rendering-csv-and-tsv-data/">render text data files</a>, and <a href="https://help.github.com/articles/rendering-differences-in-prose-documents/">track changes in text</a>.</p></li>
</ul>
<p>Github was developed for software development, so much of the functionality and terminology of that is exciting for professional programmers (e.g., branches and pull requests) isn’t necessarily the right place for us as new R users to get started.</p>
<p>So we will be learning and practicing GitHub’s features and terminology on a “need to know basis” as we start managing our projects with GitHub.</p>
</div>
</div>
<div id="github-configuration" class="section level2" number="4.3">
<h2><span class="header-section-number">4.3</span> Github Configuration</h2>
<p>We’ve just configured Github this at the end of Chapter <a href="rstudio.html#rstudio">3</a>. So skip to the next section if you’ve just completed this! However, if you’re dropping in on this chapter to setup Github, make sure you first <a href="rstudio.html#github-brief-intro-config">configure Github with these instructions</a> before continuing.</p>
<!---
### Some Github terminology
* **User**: A Github account for you (e.g., jules32).
* **Organization**: The Github account for one or more user (e.g., datacarpentry).
* **Repository**: A folder within the organization that includes files dedicated to a project.
* **Local Github**: Copies of Github files located your computer.
* **Remote Github**: Github files located on the https://github.com website.
* **Clone**: Process of making a local copy of a remote Github repository. This only needs to be done once (unless you mess up your local copy).
* **Pull**: Copy changes on the remote Github repository to your local Github repository. This is useful if multiple people are making changes to a repository.
* **Push**: Save local changes to remote Github
<br />
<br />
[](img/push_pull_clone.png)
<br />
<br />
--->
</div>
<div id="create-a-repository-on-github.com" class="section level2" number="4.4">
<h2><span class="header-section-number">4.4</span> Create a repository on Github.com</h2>
<p>Let’s get started by going to <a href="https://github.com" class="uri">https://github.com</a> and going to our user profile. You can do this by typing your username in the URL (github.com/username), or after signing in, by clicking on the top-right button and going to your profile.</p>
<p>This will have an overview of you and your work, and then you can click on the Repository tab</p>
<p>Repositories are the main “unit” of GitHub: they are what GitHub tracks. They are essentially project-level folders that will contain everything associated with a project. It’s where we’ll start too.</p>
<p>We create a new repository (called a “repo”) by clicking “New repository.”</p>
<p><br></p>
<p><img src="img/gh_repo_create.png" width="80%" /></p>
<p><br></p>
<p>Choose a name. Call it whatever you want (the shorter the better), or follow me for convenience. I will call mine <code>r-workshop</code>.</p>
<p>Also, add a description, make it public, create a README file, and create your repo!</p>
<p><br></p>
<p><img src="img/gh_repo_create2.png" width="80%" /></p>
<p><br></p>
<p>The <em>Add gitignore</em> option adds a document where you can identify files or file-types you want Github to ignore. These files will stay in on the local Github folder (the one on your computer), but will not be uploaded onto the web version of Github.</p>
<p>The <em>Add a license</em> option adds a license that describes how other people can use your Github files (e.g., open source, but no one can profit from them, etc.). We won’t worry about this today.</p>
<p>Check out our new repository!</p>
<p><br></p>
<p><img src="img/gh_repo_new.png" width="80%" /></p>
<p><br></p>
<p>Great! So now we have our new repository that exists in the Cloud. Let’s get it established locally on our computers: that is called “cloning.”</p>
</div>
<div id="clone-your-repository-using-rstudio" class="section level2" number="4.5">
<h2><span class="header-section-number">4.5</span> Clone your repository using RStudio</h2>
<p>Let’s clone this repo to our local computer using RStudio. Unlike downloading, cloning keeps all the version control and user information bundled with the files.</p>
<div id="copy-the-repo-address" class="section level3" number="4.5.1">
<h3><span class="header-section-number">4.5.1</span> Copy the repo address</h3>
<p>First, copy the web address of the repository you want to clone. We will use HTTPS.</p>
<blockquote>
<p><strong>Aside</strong>: HTTPS is default, but you could alternatively set up with SSH. This is more advanced than we will get into here, but allows 2-factor authentication. See <a href="https://happygitwithr.com/credential-caching.html#special-consideration-re-two-factor-authentication">Happy Git with R</a> for more information.</p>
</blockquote>
<p><br></p>
<p><img src="img/gh_repo_clone1.png" width="100%" /></p>
<p><br></p>
</div>
<div id="rstudio-new-project-1" class="section level3" number="4.5.2">
<h3><span class="header-section-number">4.5.2</span> RStudio: New Project</h3>
<p>Now go back to RStudio, and click on New Project. There are a few different ways; you could also go to File > New Project…, or click the little green + with the R box in the top left.
also in the File menu).</p>
<p><br></p>
<p><img src="img/new_project1.png" width="80%" /></p>
<p><br></p>
</div>
<div id="select-version-control-1" class="section level3" number="4.5.3">
<h3><span class="header-section-number">4.5.3</span> Select Version Control</h3>
<p><br></p>
<p><img src="img/new_project2.png" width="80%" /></p>
<p><br></p>
</div>
<div id="select-git-1" class="section level3" number="4.5.4">
<h3><span class="header-section-number">4.5.4</span> Select Git</h3>
<p>Since we are using git.</p>
<p><br></p>
<p><img src="img/new_project3.png" width="80%" /></p>
<p><br></p>
</div>
<div id="paste-the-repo-address" class="section level3" number="4.5.5">
<h3><span class="header-section-number">4.5.5</span> Paste the repo address</h3>
<p>Paste the repo address (which is still in your clipboard) into in the “Repository URL” field. The “Project directory name” should autofill; if it does not press <em>tab</em>, or type it in. It is best practice to keep the “Project directory name” THE SAME as the repository name.</p>
<p>When cloned, this repository is going to become a folder on your computer.</p>
<p>At this point you can save this repo anywhere. There are different schools of thought but we think it is useful to create a high-level folder where you will keep your github repos to keep them organized. We call ours <code>github</code> and keep it in our root folder (<code>~/github</code>), and so that is what we will demonstrate here — you are welcome to do the same. Press “Browse…” to navigate to a folder and you have the option of creating a new folder.</p>
<p>Finally, click Create Project.</p>
<p><br></p>
<p><img src="img/new_project4.png" width="80%" /></p>
<p><br></p>
</div>
<div id="admire-your-local-repo" class="section level3" number="4.5.6">
<h3><span class="header-section-number">4.5.6</span> Admire your local repo</h3>
<p>If everything went well, the repository will show up in RStudio!</p>
<p><br></p>
<p><img src="img/new_project5.png" width="100%" /></p>
<p><br></p>
<p>The repository is also saved to the location you specified, and you can navigate to it as you normally would in Finder or Windows Explorer:</p>
<p><br></p>
<p><img src="img/new_project6.png" width="80%" /></p>
<p><br></p>
<p>Hooray!</p>
</div>
<div id="inspect-your-local-repo" class="section level3" number="4.5.7">
<h3><span class="header-section-number">4.5.7</span> Inspect your local repo</h3>
<p>Let’s notice a few things:</p>
<p>First, our working directory is set to <code>~/github/r-workshop</code>, and <code>r-workshop</code> is also named in the top right hand corner.</p>
<p>Second, we have a Git tab in the top right pane! Let’s click on it.</p>
<p><br></p>
<p><img src="img/new_project5_annotated.png" width="80%" /></p>
<p><br></p>
<p>Our Git tab has 2 items:</p>
<ul>
<li>.gitignore file</li>
<li>.Rproj file</li>
</ul>
<p>These have been added to our repo by RStudio — we can also see them in the File pane in the bottom right of RStudio. These are helper files that RStudio has added to streamline our workflow with GitHub and R. We will talk about these a bit more soon. One thing to note about these files is that they begin with a period (<code>.</code>) which means they are hidden files: they show up in the Files pane of RStudio but won’t show up in your Finder or Windows Explorer.</p>
<p>Going back to the Git tab, both these files have little yellow icons with question marks <code>?</code>. This is GitHub’s way of saying: “I am responsible for tracking everything that happens in this repo, but I’m not sure what is going on with these files yet. Do you want me to track them too?”</p>
<p>We will handle this in a moment; first let’s look at the README.md file.</p>
</div>
<div id="edit-your-readme-file" class="section level3" number="4.5.8">
<h3><span class="header-section-number">4.5.8</span> Edit your README file</h3>
<p>Let’s also open up the README.md. This is a Markdown file, which is the same language we just learned with R Markdown. It’s like an R Markdown file without the abilities to run R code.</p>
<p>We will edit the file and illustrate how GitHub tracks files that have been modified (to complement seeing how it tracks files that have been added.</p>
<p>README files are common in programming; they are the first place that someone will look to see why code exists and how to run it.</p>
<p>In my README, I’ll write:</p>
<pre><code>This repo is for my analyses at RStudio::conf(2020). </code></pre>
<p>When I save this, notice how it shows up in my Git tab. It has a blue “M”: GitHub is already tracking this file, and tracking it line-by-line, so it knows that something is different: it’s Modified with an M.</p>
<p>Great. Now let’s sync back to GitHub in 4 steps.</p>
</div>
</div>
<div id="sync-from-rstudio-local-to-github-remote" class="section level2" number="4.6">
<h2><span class="header-section-number">4.6</span> Sync from RStudio (local) to GitHub (remote)</h2>
<p>Syncing to GitHub.com means 4 steps:</p>
<ol style="list-style-type: decimal">
<li>Pull</li>
<li>Stage</li>
<li>Commit</li>
<li>Push</li>
</ol>
<p><br></p>
<p><img src="img/commit_steps.png" width="100%" /></p>
<p><br></p>
<p>We start off this whole process by clicking on the Commit section.</p>
<p><br></p>
<p><img src="img/commit_circled.png" width="100%" /></p>
<p><br></p>
<div id="pull" class="section level3" number="4.6.1">
<h3><span class="header-section-number">4.6.1</span> Pull</h3>
<p>We start off by “Pulling” from the remote repository (GitHub.com) to make sure that our local copy has the most up-to-date information that is available online. Right now, since we just created the repo and are the only ones that have permission to work on it, we can be pretty confident that there isn’t new information available. But we pull anyways because this is a very safe habit to get into for when you start collaborating with yourself across computers or others. Best practice is to pull often: it costs nothing (other than an internet connection).</p>
<p>Pull by clicking the teal Down Arrow. (Notice also how when you highlight a filename, a preview of the differences displays below).</p>
<p><br></p>
<p><img src="img/commit_pull.png" width="100%" /></p>
<p><br></p>
</div>
<div id="stage" class="section level3" number="4.6.2">
<h3><span class="header-section-number">4.6.2</span> Stage</h3>
<p>Let’s click the boxes next to each file. This is called “staging a file”: you are indicating that you want GitHub to track this file, and that you will be syncing it shortly. Notice:</p>
<ul>
<li>.Rproj and .gitignore files: the question marks turn into an A because these are new files that have been added to your repo (automatically by RStudio, not by you).</li>
<li>README.md file: the M indicates that this was modified (by you)</li>
</ul>
<p>These are the codes used to describe how the files are changed, (from the RStudio <a href="http://www.rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf">cheatsheet</a>):</p>
<p><br></p>
<p><img src="img/commit_codes_added_modified.png" width="30%" /></p>
<p><br></p>
</div>
<div id="commit" class="section level3" number="4.6.3">
<h3><span class="header-section-number">4.6.3</span> Commit</h3>
<p>Committing is different from saving our files (which we still have to do! RStudio will indicate a file is unsaved with red text and an asterix). We commit a single file or a group of files when we are ready to save a snapshot in time of the progress we’ve made. Maybe this is after a big part of the analysis was done, or when you’re done working for the day.</p>
<p>Committing our files is a 2-step process.</p>
<p>First, you write a “commit message,” which is a human-readable note about what has changed that will accompany GitHub’s non-human-readable alphanumeric code to track our files. I think of commit messages like breadcrumbs to my Future Self: how can I use this space to be useful for me if I’m trying to retrace my steps (and perhaps in a panic?).</p>
<p>Second, you press Commit.</p>
<p><br></p>
<p><img src="img/commit_message_arrow.png" width="100%" /></p>
<p><br></p>
<p>When we have committed successfully, we get a rather unsuccessful-looking pop-up message. You can read this message as “Congratulations! You’ve successfully committed 3 files, 2 of which are new!” It is also providing you with that alphanumeric SHA code that GitHub is using to track these files.</p>
<p>If our attempt was not successful, we will see an Error. Otherwise, interpret this message as a joyous one.</p>
<blockquote>
<p>Does your pop-up message say “Aborting commit due to empty commit message.” GitHub is really serious about writing human-readable commit messages.</p>
</blockquote>
<p><br></p>
<p><img src="img/commit_success.png" width="100%" /></p>
<p><br></p>
<p>When we close this window there is going to be (in my opinion) a very subtle indication that we are not done with the syncing process.</p>
<p><br></p>
<p><img src="img/commit_branch_ahead_of_origin_master.png" width="100%" /></p>
<p><br></p>
<p>We have successfully committed our work as a breadcrumb-message-approved snapshot in time, but it still only exists locally on our computer. We can commit without an internet connection; we have not done anything yet to tell GitHub that we want this pushed to the remote repo at GitHub.com. So as the last step, we push.</p>
</div>
<div id="push" class="section level3" number="4.6.4">
<h3><span class="header-section-number">4.6.4</span> Push</h3>
<p>The last step in the syncing process is to Push!</p>
<p><br></p>
<p><img src="img/commit_push.png" width="100%" /></p>
<p><br></p>
<p>Awesome! We’re done here in RStudio for the moment, let’s check out the remote on GitHub.com.</p>
</div>
</div>
<div id="commit-history" class="section level2" number="4.7">
<h2><span class="header-section-number">4.7</span> Commit history</h2>
<p>The files you added should be on github.com.</p>
<p>Notice how the README.md file we created is automatically displayed at the bottom. Since it is good practice to have a README file that identifies what code does (i.e. why it exists), GitHub will display a Markdown file called README nicely formatted.</p>
<p><br></p>
<p><img src="img/gh_repo_view.png" width="100%" /></p>
<p><br></p>
<p>Let’s also explore the commit history. The 2 commits we’ve made (the first was when we originally initiated the repo from GitHub.com) are there!</p>
</div>
<div id="project-oriented-workflows" class="section level2" number="4.8">
<h2><span class="header-section-number">4.8</span> Project-oriented workflows</h2>
<p>Let’s go back to RStudio and how we set up well-organized projects and workflows for our data analyses.</p>
<p>This GitHub repository is now also an RStudio Project (capital P Project). This just means that RStudio has saved this additional file with extension <code>.Rproj</code> (ours is <code>r-workshop.Rproj</code>) to store specific settings for this project. It’s a bit of technology to help us get into the good habit of having a project-oriented workflow.</p>
<p>A <a href="https://rstats.wtf/project-oriented-workflow.html">project-oriented workflow</a> means that we are going to organize all of the relevant things we need for our analyses in the same place. That means that this is the place where we keep all of our data, code, figures, notes, etc.</p>
<p>R Projects are great for reproducibility, because our self-contained working directory will be the <strong>first</strong> place R looks for files.</p>
<!---
Why does this matter? It's convenient for us to have everything associated with our analyses close at-hand. When we work with different files in R (like data or saved graphs) we always need to tell R where things "live" by identifying its file path. If files are scattered across your computer, we would have to keep track of many different filepaths. So using RStudio Projects and having a project-oriented workflow and mindset makes our analysis less brittle and more portable — across people, time, and computers.
--->
<div id="working-directory" class="section level3" number="4.8.1">
<h3><span class="header-section-number">4.8.1</span> Working directory</h3>
<p>Now that we have our Project, let’s revisit this important question: where are we? Now we are in our Project. Everything we do will by default be saved here so we can be nice and organized.</p>
<p>And this is important because if Allison clones this repository that you just made and saves it in <code>Allison/my/projects/way/over/here</code>, she will still be able to interact with your files as you are here.</p>
<p><img src="img/RStudio_IDE_projdir.png" width="100%" /></p>
</div>
</div>
<div id="project-oriented-workflows-in-action-aka-our-analytical-setup" class="section level2" number="4.9">
<h2><span class="header-section-number">4.9</span> Project-oriented workflows in action (aka our analytical setup)</h2>
<p>Let’s get a bit organized. First, let’s create our a new R Markdown file where we will do our analyses. This will be nice because you can also write notes to yourself in this document.</p>
<div id="create-a-new-rmd-file" class="section level3" number="4.9.1">
<h3><span class="header-section-number">4.9.1</span> Create a new Rmd file</h3>
<p>So let’s do this (again):</p>
<p>File > New File > R Markdown … (or click the green plus in the top left corner).</p>
<p>Let’s set up this file so we can use it for the rest of the day. I’m going to update the header with a new title and add my name, and then I’m going to delete the rest of the document so that we have a clean start.</p>
<blockquote>
<p><strong>Efficiency Tip</strong>: I use Shift - Command - Down Arrow to highlight text from my cursor to the end of the document</p>
</blockquote>
<pre><code>---
title: "Creating graphs in R with `ggplot2`"
author: "Julie Lowndes"
date: "01/27/2020"
output: html_document
---
# Plots with ggplot2
We are going to make plots in R and it's going to be amazing.
</code></pre>
<p>Now, let’s save it. I’m going to call my file <code>plots-ggplot.Rmd</code>.</p>
<p>Notice that when we save this file, it pops up in our Git tab. Git knows that there is something new in our repo.</p>
<p>Let’s also knit this file. And look: Git also sees the knitted .html.</p>
<p>And let’s practice syncing our file to GitHub: pull, stage, commit, push</p>
<blockquote>
<p><strong>Troubleshooting:</strong> What if a file doesn’t show up in the Git tab and you expect that it should? Check to make sure you’ve saved the file. If the filename is red with an asterix, there have been changes since it was saved. Remember to save before syncing to GitHub!</p>
</blockquote>
</div>
<div id="create-data-and-figures-folders" class="section level3" number="4.9.2">
<h3><span class="header-section-number">4.9.2</span> Create data and figures folders</h3>
<p>Let’s create a few folders to be organized. Let’s have one for our the raw data, and one for the figures we will output. We can do this in RStudio, in the bottom right pane Files pane by clicking the New Folder button:</p>
<ul>
<li>folder called “data”</li>
<li>folder called “figures”</li>
</ul>
<p>We can press the refresh button in the top-right of this pane (next to the “More” button) to have these show up in alphabetical order.</p>
<p>Now let’s go to our Finder or Windows Explorer: our new folders are there as well!</p>
</div>
<div id="move-data-files-to-data-folder" class="section level3" number="4.9.3">
<h3><span class="header-section-number">4.9.3</span> Move data files to data folder</h3>
<p>You downloaded several files for this workshop from the <a href="https://drive.google.com/drive/folders/1RywSUw8hxETlROdIhLIntxPsZq0tKSdS?usp=sharing">r-for-excel-data folder</a>, and we’ll move these data into our repo now. These data files are a mix of comma separate value (.csv) files and some as Excel spreadsheets (.xlsx):</p>
<ul>
<li>ca_np.csv</li>
<li>ci_np.xlsx</li>
<li>fish.csv</li>
<li>inverts.xlsx</li>
<li>kelp_fronds.xlsx</li>
<li>lobsters.xlsx</li>
<li>lobsters2.xlsx</li>
<li>noaa_landings.csv</li>
<li>substrate.xlsx</li>
</ul>
<p>Copy-paste or drag all of these files into the ‘data’ subfolder of your R project. Make sure you do not also copy the original folder; we don’t need any subfolders in our data folder.</p>
<p>Now let’s go back to RStudio. We can click on the data folder in the Files tab and see them.</p>
<p>The data folder also shows up in your Git tab. But the figures folder does not. That is because GitHub cannot track an empty folder, it can only track files within a folder.</p>
<p>Let’s sync these data files (we will be able to sync the figures folder shortly). We can stage multiple files at once by typing Command - A and clicking “Stage” (or using the space bar). To Sync: pull - stage - commit - push!</p>
</div>
<div id="activity-1" class="section level3" number="4.9.4">
<h3><span class="header-section-number">4.9.4</span> Activity</h3>
<p>Edit your README and practice syncing (pull, stage, commit, push). For example,</p>
<pre><code>"We use the following data from the Santa Barbara Coastal Term Ecological Research and National Oceanic and Atmospheric Administration in our analyses"</code></pre>
<p>Explore your Commit History, and discuss with your neighbor.</p>
</div>
</div>
<div id="committing---how-often-tracking-changes-in-your-files" class="section level2" number="4.10">
<h2><span class="header-section-number">4.10</span> Committing - how often? Tracking changes in your files</h2>
<p>Whenever you make changes to the files in Github, you will walk through the Pull -> Stage -> Commit -> Push steps.</p>
<p>I tend to do this every time I finish a task (basically when I start getting nervous that I will lose my work). Once something is committed, it is very difficult to lose it.</p>
</div>
<div id="issues" class="section level2" number="4.11">
<h2><span class="header-section-number">4.11</span> Issues</h2>
<p>Let’s go back to our repo on GitHub.com, and talk about Issues.</p>
<p>Issues “track ideas, enhancements, tasks, or bugs for work on GitHub.” - <a href="https://help.github.com/en/articles/about-issues">GitHub help article</a>.</p>
<p>You can create an issue for a topic, track progress, others ask questions, provide links and updates, close issue when completed.</p>
<p>In a public repo, anyone with a username can create and comment on issues. In a private repo, only users with permission can create and comment on issues, or see them at all.</p>
<p>GitHub search is awesome – will search code and issues!</p>
<div id="issues-in-the-wild" class="section level3" number="4.11.1">
<h3><span class="header-section-number">4.11.1</span> Issues in the wild!</h3>
<p>Here are some examples of “traditional” and “less traditional” Issues:</p>
<p>Bug reports, code, feature, & help requests: <a href="https://github.com/tidyverse/ggplot2/issues">ggplot2</a></p>
<p><br></p>
<p><img src="img/issues_ggplot2.png" width="100%" /></p>
<p><br></p>
<p>Project submissions and progress tracking: <a href="https://github.com/MozillaFestival/mozfest-program-2018/issues">MozillaFestival</a></p>
<p><br></p>
<p><img src="img/issues_MozillaFestival.png" width="100%" /></p>
<p><br></p>
<p>Private conversations and archiving: <a href="https://github.com/OHI-Science/globalfellows-issues/issues/">OHI Fellows (private)</a></p>
<p><br></p>
<p><img src="img/issues_globalfellows.png" width="100%" /></p>
<p><br></p>
</div>
<div id="end-github-session" class="section level3" number="4.11.2">
<h3><span class="header-section-number">4.11.2</span> END <strong>GitHub</strong> session!</h3>
<p>We’ll continue practicing GitHub throughout the rest of the book, but see Chapter <a href="collaborating.html#collaborating">9</a> for explicit instructions on collaborating in GitHub.</p>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<a href="rstudio.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="ggplot2.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": null,
"text": null
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": ["R for Excel Users.epub"],
"toc": {
"collapse": "subsection"
}
});
});
</script>
</body>
</html>