-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4_summarizing_and_transforming_answers.html
More file actions
5736 lines (5361 loc) · 255 KB
/
Copy path4_summarizing_and_transforming_answers.html
File metadata and controls
5736 lines (5361 loc) · 255 KB
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
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en"><head>
<script src="4_summarizing_and_transforming_files/libs/clipboard/clipboard.min.js"></script>
<script src="4_summarizing_and_transforming_files/libs/quarto-html/tabby.min.js"></script>
<script src="4_summarizing_and_transforming_files/libs/quarto-html/popper.min.js"></script>
<script src="4_summarizing_and_transforming_files/libs/quarto-html/tippy.umd.min.js"></script>
<link href="4_summarizing_and_transforming_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="4_summarizing_and_transforming_files/libs/quarto-html/light-border.css" rel="stylesheet">
<link href="4_summarizing_and_transforming_files/libs/quarto-html/quarto-syntax-highlighting-e26003cea8cd680ca0c55a263523d882.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<link href="4_summarizing_and_transforming_files/libs/quarto-contrib/fontawesome6-0.1.0/all.css" rel="stylesheet">
<link href="4_summarizing_and_transforming_files/libs/quarto-contrib/fontawesome6-0.1.0/latex-fontsize.css" rel="stylesheet"><meta charset="utf-8">
<meta name="generator" content="quarto-1.6.39">
<meta name="dcterms.date" content="2026-02-19">
<title>Summarizing & Transforming Data in R</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="4_summarizing_and_transforming_files/libs/revealjs/dist/reset.css">
<link rel="stylesheet" href="4_summarizing_and_transforming_files/libs/revealjs/dist/reveal.css">
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; 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
{ color: #003b4f; background-color: #f1f3f5; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span { color: #003b4f; } /* Normal */
code span.al { color: #ad0000; } /* Alert */
code span.an { color: #5e5e5e; } /* Annotation */
code span.at { color: #657422; } /* Attribute */
code span.bn { color: #ad0000; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #003b4f; font-weight: bold; } /* ControlFlow */
code span.ch { color: #20794d; } /* Char */
code span.cn { color: #8f5902; } /* Constant */
code span.co { color: #5e5e5e; } /* Comment */
code span.cv { color: #5e5e5e; font-style: italic; } /* CommentVar */
code span.do { color: #5e5e5e; font-style: italic; } /* Documentation */
code span.dt { color: #ad0000; } /* DataType */
code span.dv { color: #ad0000; } /* DecVal */
code span.er { color: #ad0000; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #ad0000; } /* Float */
code span.fu { color: #4758ab; } /* Function */
code span.im { color: #00769e; } /* Import */
code span.in { color: #5e5e5e; } /* Information */
code span.kw { color: #003b4f; font-weight: bold; } /* Keyword */
code span.op { color: #5e5e5e; } /* Operator */
code span.ot { color: #003b4f; } /* Other */
code span.pp { color: #ad0000; } /* Preprocessor */
code span.sc { color: #5e5e5e; } /* SpecialChar */
code span.ss { color: #20794d; } /* SpecialString */
code span.st { color: #20794d; } /* String */
code span.va { color: #111111; } /* Variable */
code span.vs { color: #20794d; } /* VerbatimString */
code span.wa { color: #5e5e5e; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="4_summarizing_and_transforming_files/libs/revealjs/dist/theme/quarto-560a7fb8c8fb23736e113fee4ef09eaa.css">
<link href="4_summarizing_and_transforming_files/libs/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
<link href="4_summarizing_and_transforming_files/libs/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
<link href="4_summarizing_and_transforming_files/libs/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
<link href="4_summarizing_and_transforming_files/libs/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
<style type="text/css">
.reveal div.sourceCode {
margin: 0;
overflow: auto;
}
.reveal div.hanging-indent {
margin-left: 1em;
text-indent: -1em;
}
.reveal .slide:not(.center) {
height: 100%;
}
.reveal .slide.scrollable {
overflow-y: auto;
}
.reveal .footnotes {
height: 100%;
overflow-y: auto;
}
.reveal .slide .absolute {
position: absolute;
display: block;
}
.reveal .footnotes ol {
counter-reset: ol;
list-style-type: none;
margin-left: 0;
}
.reveal .footnotes ol li:before {
counter-increment: ol;
content: counter(ol) ". ";
}
.reveal .footnotes ol li > p:first-child {
display: inline-block;
}
.reveal .slide ul,
.reveal .slide ol {
margin-bottom: 0.5em;
}
.reveal .slide ul li,
.reveal .slide ol li {
margin-top: 0.4em;
margin-bottom: 0.2em;
}
.reveal .slide ul[role="tablist"] li {
margin-bottom: 0;
}
.reveal .slide ul li > *:first-child,
.reveal .slide ol li > *:first-child {
margin-block-start: 0;
}
.reveal .slide ul li > *:last-child,
.reveal .slide ol li > *:last-child {
margin-block-end: 0;
}
.reveal .slide .columns:nth-child(3) {
margin-block-start: 0.8em;
}
.reveal blockquote {
box-shadow: none;
}
.reveal .tippy-content>* {
margin-top: 0.2em;
margin-bottom: 0.7em;
}
.reveal .tippy-content>*:last-child {
margin-bottom: 0.2em;
}
.reveal .slide > img.stretch.quarto-figure-center,
.reveal .slide > img.r-stretch.quarto-figure-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-left,
.reveal .slide > img.r-stretch.quarto-figure-left {
display: block;
margin-left: 0;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-right,
.reveal .slide > img.r-stretch.quarto-figure-right {
display: block;
margin-left: auto;
margin-right: 0;
}
</style>
</head>
<body class="quarto-light">
<div class="reveal">
<div class="slides">
<section id="title-slide" data-background-image="figures/horst_tidydata.jpg" data-background-position="95% 85%" data-background-size="50%" class="center">
<p class="absolute" style="top:0">Workshop: Dealing with Data in R</p>
<p style="position:absolute;top:0;right:0;color:grey;font-size:60%;text-align:right">Illustration from the Openscapes blog Tidy Data for<br>reproducibility, efficiency, and collaboration by Julia Lowndes and Allison Horst</p>
<h1 class="title" style="padding-top: 150px;">Summarizing & Transforming Data in R</h1>
<h3 class="subtitle" style="padding-top:5px;"><strong>Saving you time and sanity</strong></h3>
<p style="font-size:70%; padding-top: 120px">
<i class="fa-brands fa-github"></i> <a href="https://github.com/steffilazerte">steffilazerte</a><br>
<i class="fa-brands fa-mastodon"></i> <a href="https://fosstodon.org/@steffilazerte">@[email protected]</a><br>
<i class="fa-brands fa-twitter"></i> <a href="https://twitter.com/steffilazerte">@steffilazerte</a><br>
<i class="fa-solid fa-globe"></i> <a href="https://steffilazerte.ca">steffilazerte.ca</a><br>
<img src="figures/steffi_logo.png" width="30%">
</p>
<p class="date">Compiled: 2026-02-19</p>
</section>
<section>
<section id="first-things-first" class="title-slide slide level1 center">
<h1>First things first</h1>
<div style="text-align:left; padding: 15px 200px 15px 200px">
<p><i class="fa-solid fa-floppy-disk" aria-label="floppy-disk"></i> Save previous script</p>
<p><i class="fa-solid fa-folder-open" aria-label="folder-open"></i> Open New File <br> <span class="small hang">(make sure you’re in the RStudio Project)</span></p>
<p><i class="fa-solid fa-pen" aria-label="pen"></i> Write <code>library(tidyverse)</code> at the top</p>
<p><i class="fa-solid fa-floppy-disk" aria-label="floppy-disk"></i> Save this new script <br> <span class="small hang">(consider names like <code>summarizing.R</code> or <code>4_sum_and_trans.R</code>)</span></p>
</div>
</section>
<section id="types-of-modifications" class="slide level2">
<h2>Types of Modifications</h2>
<div class="columns">
<div class="column">
<h3 id="subset">1. <strong>Subset</strong></h3>
<ul>
<li><code>filter()</code> observations (rows)</li>
<li><code>select()</code> variables (columns)</li>
</ul>
<h3 id="joining-data-sets">2. <strong>Joining data sets</strong></h3>
<ul>
<li><code>left_join()</code>, <code>right_join()</code>, etc.</li>
</ul>
<h3 id="creating-new-columns">3. <strong>Creating new columns</strong></h3>
<ul>
<li>Creating categories</li>
<li>Column calculations</li>
<li>By group</li>
<li><code>mutate()</code> (and <code>group_by()</code>)</li>
</ul>
</div><div class="column">
<h3 id="summarize-existing-columns">4. <strong>Summarize existing columns</strong></h3>
<ul>
<li>Summarizing by group</li>
<li><code>summarize()</code></li>
</ul>
<h3 id="transpose">5. <strong>Transpose</strong></h3>
<ul>
<li>Going between <strong>wide</strong> and <strong>long</strong> data formats
<ul>
<li><code>pivot_wider()</code> and <code>pivot_longer()</code></li>
</ul></li>
<li>Transposing for analysis</li>
<li>Transposing for visualizations</li>
</ul>
</div></div>
</section>
<section id="getting-ready" class="slide level2">
<h2>Getting ready</h2>
<div class="columns">
<div class="column">
<h3 id="check-out-the-data">Check out the data:</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href=""></a><span class="fu">library</span>(tidyverse)</span>
<span id="cb1-2"><a href=""></a>size <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"data/grain_size2.csv"</span>)</span>
<span id="cb1-3"><a href=""></a>size</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div><div class="column">
<h3 id="using-data-sets">Using data sets:</h3>
<ul>
<li><a href="https://steffilazerte.ca/workshop-dealing-with-data/data/grain_size2.csv">🔗<code>grain_size2.csv</code></a></li>
<li><a href="https://steffilazerte.ca/workshop-dealing-with-data/data/grain_meta.csv">🔗<code>grain_meta.csv</code></a></li>
</ul>
</div></div>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 114 × 9
plot depth coarse_sand medium_sand fine_sand coarse_silt medium_silt fine_silt clay
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 CSP01 4 13.0 17.4 19.7 14.1 11.2 8.17 16.3
2 CSP01 12 10.7 16.9 19.2 14.1 11.7 9.03 18.4
3 CSP01 35 12.1 17.8 16.1 10.3 9.51 7.47 26.7
4 CSP01 53 17.6 18.2 14.3 9.4 9.1 8.7 22.7
5 CSP01 83 21.0 18.4 14.3 9.79 8.79 7.29 20.4
6 CSP01 105 19.0 18.4 14.4 10.8 9.4 8.22 19.7
7 CSP08 10 11.6 17.1 20.8 16.3 9.55 6.23 18.4
8 CSP08 27 15.4 16.2 17.8 14.3 10.4 6.1 19.6
9 CSP08 90 14.9 15.8 18.6 15.1 11.5 7.56 16.5
10 CSP02 5 8.75 8.64 8.66 12.0 18.3 15.2 28.5
# ℹ 104 more rows</code></pre>
</div>
</div>
</section></section>
<section>
<section id="subsetting" class="title-slide slide level1 center">
<h1>Subsetting</h1>
<p><span class="large">By rows and column</span></p>
</section>
<section id="filter-observations" class="slide level2">
<h2><code>filter()</code> observations</h2>
<h3 class="spacer" id="filter-is-from-dplyr"><code>filter()</code> is from <code>dplyr</code>*</h3>
<p><span class="footnote">* part of the <code>tidyverse</code></span></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href=""></a><span class="fu">filter</span>(data, expression1, expression2, etc.)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="spacer">
<ul>
<li><code>tidyverse</code> functions always start with data</li>
<li>Column <code>expression</code>s reference actual columns in data</li>
<li>Here we use logical statements relating to column values</li>
</ul>
</div>
<p><img data-src="figures/hex_dplyr.png" class="absolute" style="top: 0px; right: 0px; width: 20%; " alt="Hex logo for the dplyr R package"></p>
</section>
<section id="filter-observations-1" class="slide level2">
<h2><code>filter()</code> observations</h2>
<h3 class="spacer" id="filter-by-category"><code>filter()</code> by category</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href=""></a><span class="fu">filter</span>(size, plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP11"</span>, <span class="st">"CSP13"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 9 × 9
plot depth coarse_sand medium_sand fine_sand coarse_silt medium_silt fine_silt clay
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 CSP13 2 22.1 17.5 18.3 11.9 7.92 6.05 16.3
2 CSP13 10 12.1 14.9 18 13.1 10.4 7.92 23.6
3 CSP13 25 13.7 12.7 14.3 11.7 9.67 6.31 31.6
4 CSP13 60 27.1 9.74 11.1 9.69 9.79 7.82 24.8
5 CSP13 140 10.4 15.3 16.0 12.4 12.4 10.2 23.5
6 CSP11 20 6.67 3.94 5.52 23.7 23 14.8 22.3
7 CSP11 30 5.27 4.23 6.11 23.6 23.9 15.3 21.6
8 CSP11 47 4.34 4.03 6.62 24.5 25.5 13.8 21.3
9 CSP11 143 5.28 4.26 7.07 22.8 28.0 12.4 20.2</code></pre>
</div>
</div>
<p><img data-src="figures/hex_dplyr.png" class="absolute" style="top: 0px; right: 0px; width: 20%; " alt="Hex logo for the dplyr R package"></p>
<div class="fragment">
<p><strong>Note</strong>: To save this as a separate object, don’t forget assignments:</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href=""></a>size_sub <span class="ot"><-</span> <span class="fu">filter</span>(size, plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP11"</span>, <span class="st">"CSP13"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</section>
<section id="filter-observations-2" class="slide level2">
<h2><code>filter()</code> observations</h2>
<h3 class="spacer" id="filter-by-measures"><code>filter()</code> by measures</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href=""></a><span class="fu">filter</span>(size, depth <span class="sc">></span> <span class="dv">140</span> <span class="sc">|</span> depth <span class="sc"><</span> <span class="dv">4</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 9 × 9
plot depth coarse_sand medium_sand fine_sand coarse_silt medium_silt fine_silt clay
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 CSP13 2 22.1 17.5 18.3 11.9 7.92 6.05 16.3
2 CSP19 190 3.33 4.28 14.2 42.8 21.5 9.92 4
3 CSP11 143 5.28 4.26 7.07 22.8 28.0 12.4 20.2
4 CSP14 3 16.1 15.0 17.5 12.2 12 9.88 17.3
5 CSP15 146 13.6 12.3 12.5 12.0 18.1 10.4 21.1
6 CSP20 3 5.12 5.09 17.9 25.9 14.3 11.8 19.9
7 CSP20 150 22.7 12.9 12.7 17.7 14.9 7.59 11.5
8 CSP21 3 14.1 11.6 11.9 14.1 15.5 10.4 22.4
9 CSP22 182 17.9 13.6 13.1 13.5 12.6 8.39 20.9</code></pre>
</div>
</div>
<p><img data-src="figures/hex_dplyr.png" class="absolute" style="top: 0px; right: 0px; width: 20%; " alt="Hex logo for the dplyr R package"></p>
</section>
<section id="filter-observations-4" class="slide level2">
<h2><code>filter()</code> observations</h2>
<h3 class="spacer" id="filter-by-a-combination-use-comma-for-and"><code>filter()</code> by a combination <i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> use comma for <strong>AND</strong></h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb12" data-code-line-numbers="2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href=""></a><span class="fu">filter</span>(size, </span>
<span id="cb12-2"><a href=""></a> depth <span class="sc">></span> <span class="dv">100</span>,</span>
<span id="cb12-3"><a href=""></a> plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP11"</span>, <span class="st">"CSP13"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 9
plot depth coarse_sand medium_sand fine_sand coarse_silt medium_silt fine_silt clay
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 CSP13 140 10.4 15.3 16.0 12.4 12.4 10.2 23.5
2 CSP11 143 5.28 4.26 7.07 22.8 28.0 12.4 20.2</code></pre>
</div>
</div>
<div class="fragment">
<h3 id="equivalent-to-using">Equivalent to using <strong>&</strong></h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb14" data-code-line-numbers="2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href=""></a><span class="fu">filter</span>(size, </span>
<span id="cb14-2"><a href=""></a> depth <span class="sc">></span> <span class="dv">100</span> <span class="sc">&</span></span>
<span id="cb14-3"><a href=""></a> plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP11"</span>, <span class="st">"CSP13"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div>
</section></section>
<section>
<section id="tangent" class="title-slide slide level1 center">
<h1>Tangent</h1>
<p><span class="large">Logical Operators</span></p>
</section>
<section id="logical-operators" class="slide level2">
<h2>Logical Operators</h2>
<div class="columns">
<div class="column" style="width:40%;">
<h3 id="possible-options">Possible options</h3>
<table class="caption-top">
<thead>
<tr class="header">
<th>Operator</th>
<th>Code</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>OR</td>
<td><code>|</code></td>
</tr>
<tr class="even">
<td>AND</td>
<td><code>&</code></td>
</tr>
<tr class="odd">
<td>EQUAL</td>
<td><code>==</code></td>
</tr>
<tr class="even">
<td>NOT EQUAL</td>
<td><code>!=</code></td>
</tr>
<tr class="odd">
<td>NOT</td>
<td><code>!</code></td>
</tr>
<tr class="even">
<td>Greater than</td>
<td><code>></code></td>
</tr>
<tr class="odd">
<td>Less than</td>
<td><code><</code></td>
</tr>
<tr class="even">
<td>Greater than or equal to</td>
<td><code>>=</code></td>
</tr>
<tr class="odd">
<td>Less than or equal to</td>
<td><code><=</code></td>
</tr>
<tr class="even">
<td>In</td>
<td><code>%in%</code></td>
</tr>
</tbody>
</table>
</div><div class="column" style="width:60%;">
<!--
### Single comparisons
::: {.cell}
```{.r .cell-code}
1 < 2
1 != 2
```
:::
### Multiple comparisons
::: {.cell}
```{.r .cell-code}
1 == c(1, 2, 1, "apple")
1 %in% c(1, 2, 1, "apple")
c(1, 2, 1, "apple") == 1
c(1, 2, 1, "apple") %in% 1
c(1, 2, 1, "apple") == 1 | c(1, 2, 1, "apple") == 2
```
:::
> **Your turn!**
> In each case, what are you asking?<br>Do you expect 1 or 4 values?
-->
<p><strong>Your turn!</strong></p>
<p>What do the following filters do?</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href=""></a>size <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"data/grain_size2.csv"</span>)</span>
<span id="cb15-2"><a href=""></a></span>
<span id="cb15-3"><a href=""></a><span class="fu">filter</span>(size, depth <span class="sc">==</span> <span class="dv">20</span>)</span>
<span id="cb15-4"><a href=""></a><span class="fu">filter</span>(size, depth <span class="sc">==</span> <span class="dv">20</span>, clay <span class="sc"><</span> <span class="dv">20</span>)</span>
<span id="cb15-5"><a href=""></a><span class="fu">filter</span>(size, depth <span class="sc">%in%</span> <span class="fu">c</span>(<span class="dv">20</span>, <span class="dv">100</span>) <span class="sc">&</span> clay <span class="sc">==</span> <span class="dv">6</span>)</span>
<span id="cb15-6"><a href=""></a><span class="fu">filter</span>(size, <span class="sc">!</span>plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP01"</span>, <span class="st">"CSP13"</span>))</span>
<span id="cb15-7"><a href=""></a><span class="fu">filter</span>(size, depth <span class="sc">>=</span> <span class="dv">146</span>)</span>
<span id="cb15-8"><a href=""></a><span class="fu">filter</span>(size, depth <span class="sc">></span> <span class="dv">146</span>)</span>
<span id="cb15-9"><a href=""></a><span class="fu">filter</span>(size, coarse_silt <span class="sc"><</span> <span class="dv">9</span> <span class="sc">|</span> clay <span class="sc"><</span> <span class="dv">5</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div></div>
</section>
<section id="select-variables" class="slide level2">
<h2><code>select()</code> variables</h2>
<h3 class="spacer" id="select-is-from-dplyr"><code>select()</code> is from <code>dplyr</code>*</h3>
<p><span class="footnote">* part of the <code>tidyverse</code></span></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href=""></a><span class="fu">select</span>(data, selection1, selection2, etc.)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="spacer">
<ul>
<li><code>tidyverse</code> functions always start with data</li>
<li>Specify columns to keep or remove</li>
<li>Column <code>selection</code>s reference actual columns in data</li>
</ul>
</div>
<p><img data-src="figures/hex_dplyr.png" class="absolute" style="top: 0px; right: 0px; width: 20%; " alt="Hex logo for the dplyr R package"></p>
</section>
<section id="select-variables-1" class="slide level2">
<h2><code>select()</code> variables</h2>
<div class="columns spacer">
<div class="column">
<h3 id="select-by-name"><code>select()</code> by name</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href=""></a><span class="fu">select</span>(size, coarse_sand, medium_sand, fine_sand)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 114 × 3
coarse_sand medium_sand fine_sand
<dbl> <dbl> <dbl>
1 13.0 17.4 19.7
2 10.7 16.9 19.2
3 12.1 17.8 16.1
4 17.6 18.2 14.3
# ℹ 110 more rows</code></pre>
</div>
</div>
</div><div class="column fragment">
<h3 id="using-helper-functions">Using helper functions</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href=""></a><span class="fu">select</span>(size, <span class="fu">ends_with</span>(<span class="st">"sand"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 114 × 3
coarse_sand medium_sand fine_sand
<dbl> <dbl> <dbl>
1 13.0 17.4 19.7
2 10.7 16.9 19.2
3 12.1 17.8 16.1
4 17.6 18.2 14.3
# ℹ 110 more rows</code></pre>
</div>
</div>
</div></div>
<div class="fragment">
<p><strong>Some other helper functions (<code>?select_helpers</code>):</strong></p>
<table class="caption-top">
<thead>
<tr class="header">
<th>Function</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>starts_with()</code></td>
<td><code>starts_with("fine")</code></td>
</tr>
<tr class="even">
<td><code>contains()</code></td>
<td><code>contains("sand")</code></td>
</tr>
<tr class="odd">
<td><code>everything()</code></td>
<td>Useful for rearranging</td>
</tr>
<tr class="even">
<td><code>matches()</code></td>
<td>Uses regular expressions</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="select-variables-2" class="slide level2">
<h2><code>select()</code> variables</h2>
<h3 id="put-it-all-together">Put it all together</h3>
<div class="columns">
<div class="column">
<h3 id="to-explore-the-data">To explore the data</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href=""></a>size <span class="sc">|></span></span>
<span id="cb21-2"><a href=""></a> <span class="fu">filter</span>(depth <span class="sc">></span> <span class="dv">100</span>, </span>
<span id="cb21-3"><a href=""></a> plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP13"</span>, <span class="st">"CSP25"</span>)) <span class="sc">|></span></span>
<span id="cb21-4"><a href=""></a> <span class="fu">select</span>(plot, depth, <span class="fu">ends_with</span>(<span class="st">"sand"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 5
plot depth coarse_sand medium_sand fine_sand
<chr> <dbl> <dbl> <dbl> <dbl>
1 CSP13 140 10.4 15.3 16.0
2 CSP25 130 18.6 21.3 13.8</code></pre>
</div>
</div>
</div><div class="column fragment">
<h3 id="to-save-as-a-separate-object">To save as a separate object</h3>
<div class="cell">
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href=""></a>size_sub_sand <span class="ot"><-</span> size <span class="sc">|></span></span>
<span id="cb23-2"><a href=""></a> <span class="fu">filter</span>(depth <span class="sc">></span> <span class="dv">100</span>, </span>
<span id="cb23-3"><a href=""></a> plot <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"CSP13"</span>, <span class="st">"CSP25"</span>)) <span class="sc">|></span></span>
<span id="cb23-4"><a href=""></a> <span class="fu">select</span>(plot, depth, <span class="fu">ends_with</span>(<span class="st">"sand"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</div></div>
</section>
<section id="your-turn-subsetting" class="slide level2">
<h2>Your turn: Subsetting</h2>
<ul>
<li>Subset the data to variables <strong>plot</strong>, <strong>depth</strong> and all measures of <strong>sand</strong></li>
<li>Keep only values where there is <strong><u>at least</u> 30% clay</strong></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb24" data-code-line-numbers="2-3"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb24-1"><a href=""></a>size <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"data/grain_size2.csv"</span>) <span class="sc">|></span></span>
<span id="cb24-2"><a href=""></a> <span class="fu">filter</span>(???) <span class="sc">|></span></span>
<span id="cb24-3"><a href=""></a> <span class="fu">select</span>(???) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p><span class="note absolute" style="top: 20%; left: 80%; width: 20%; "><strong>Note:</strong><br>All particle values are percentages (depth is cm)</span></p>
<p><span class="note absolute" style="left: 50%; bottom: 10%; width: 60%; "><strong>Too Easy?</strong><br>What happens if you <code>select()</code> before you <code>filter()</code>?<br>How many different ways can you select these columns?</span></p>
</section>
<section id="your-turn-subsetting-1" class="slide level2" data-visibility="visible">
<h2>Your turn: Subsetting</h2>
<ul>
<li>Subset the data to variables <strong>plot</strong>, <strong>depth</strong> and all measures of <strong>sand</strong></li>
<li>Keep only values where there is <strong><u>at least</u> 30% clay</strong></li>
</ul>
<div class="cell">
<div class="sourceCode cell-code" id="cb25"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb25-1"><a href=""></a>size <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"data/grain_size2.csv"</span>) <span class="sc">|></span></span>
<span id="cb25-2"><a href=""></a> <span class="fu">filter</span>(clay <span class="sc">>=</span> <span class="dv">30</span>) <span class="sc">|></span></span>
<span id="cb25-3"><a href=""></a> <span class="fu">select</span>(plot, depth, <span class="fu">ends_with</span>(<span class="st">"sand"</span>))</span>
<span id="cb25-4"><a href=""></a></span>
<span id="cb25-5"><a href=""></a><span class="fu">head</span>(size)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 5
plot depth coarse_sand medium_sand fine_sand
<chr> <dbl> <dbl> <dbl> <dbl>
1 CSP02 36 8.15 9.24 8.55
2 CSP13 25 13.7 12.7 14.3 </code></pre>
</div>
</div>
<div class="fragment">
<p><strong>Select equivalents:</strong></p>
<ul>
<li><code>select(plot, depth, ends_with("sand"))</code></li>
<li><code>select(plot, depth, contains("sand"))</code></li>
<li><code>select(plot, depth, coarse_sand, medium_sand, fine_sand)</code></li>
<li><code>select(-coarse_silt, -medium_silt, -fine_silt, -clay)</code></li>
</ul>
</div>
</section>
<section id="your-turn-subsetting-too-easy" class="slide level2" data-visibility="visible">
<h2>Your turn: Subsetting (Too Easy?)</h2>
<p><strong>What happens if you <code>select()</code> before you <code>filter()</code>?</strong></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href=""></a>size <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"data/grain_size2.csv"</span>) <span class="sc">|></span></span>
<span id="cb27-2"><a href=""></a> <span class="fu">select</span>(plot, depth, <span class="fu">ends_with</span>(<span class="st">"sand"</span>)) <span class="sc">|></span></span>
<span id="cb27-3"><a href=""></a> <span class="fu">filter</span>(clay <span class="sc">>=</span> <span class="dv">30</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-error">
<pre><code>Error in `filter()`:
ℹ In argument: `clay >= 30`.
Caused by error:
! object 'clay' not found</code></pre>
</div>
</div>
<ul>
<li>Lines are sequential</li>
<li>First <code>select()</code> removes column <code>clay</code></li>
<li>Then <code>filter()</code> cannot find <code>clay</code>
<ul>
<li><span class="small">(<code>object 'clay' not found</code>)</span></li>
</ul></li>
</ul>
</section></section>
<section>
<section id="joining-or-merging-data" class="title-slide slide level1 center">
<h1>Joining or Merging data</h1>
</section>
<section id="joining-data-sets-1" class="slide level2">
<h2>Joining data sets</h2>
<div class="columns">
<div class="column center" style="width:40%;">
<h3 id="measurements">Measurements</h3>
<div class="cell">
<div class="cell-output-display">
<div id="rbwdbghsmn" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#rbwdbghsmn table {
font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#rbwdbghsmn thead, #rbwdbghsmn tbody, #rbwdbghsmn tfoot, #rbwdbghsmn tr, #rbwdbghsmn td, #rbwdbghsmn th {
border-style: none;
}
#rbwdbghsmn p {
margin: 0;
padding: 0;
}
#rbwdbghsmn .gt_table {
display: table;
border-collapse: collapse;
line-height: normal;
margin-left: auto;
margin-right: auto;
color: #333333;
font-size: 16px;
font-weight: normal;
font-style: normal;
background-color: #FFFFFF;
width: auto;
border-top-style: solid;
border-top-width: 2px;
border-top-color: #A8A8A8;
border-right-style: none;
border-right-width: 2px;
border-right-color: #D3D3D3;
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #A8A8A8;
border-left-style: none;
border-left-width: 2px;
border-left-color: #D3D3D3;
}
#rbwdbghsmn .gt_caption {
padding-top: 4px;
padding-bottom: 4px;
}
#rbwdbghsmn .gt_title {
color: #333333;
font-size: 125%;
font-weight: initial;
padding-top: 4px;
padding-bottom: 4px;
padding-left: 5px;
padding-right: 5px;
border-bottom-color: #FFFFFF;
border-bottom-width: 0;
}
#rbwdbghsmn .gt_subtitle {
color: #333333;
font-size: 85%;
font-weight: initial;
padding-top: 3px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 5px;
border-top-color: #FFFFFF;
border-top-width: 0;
}
#rbwdbghsmn .gt_heading {
background-color: #FFFFFF;
text-align: center;
border-bottom-color: #FFFFFF;
border-left-style: none;
border-left-width: 1px;
border-left-color: #D3D3D3;
border-right-style: none;
border-right-width: 1px;
border-right-color: #D3D3D3;
}
#rbwdbghsmn .gt_bottom_border {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
}
#rbwdbghsmn .gt_col_headings {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
border-left-style: none;
border-left-width: 1px;
border-left-color: #D3D3D3;
border-right-style: none;
border-right-width: 1px;
border-right-color: #D3D3D3;
}
#rbwdbghsmn .gt_col_heading {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
font-weight: normal;
text-transform: inherit;
border-left-style: none;
border-left-width: 1px;
border-left-color: #D3D3D3;
border-right-style: none;
border-right-width: 1px;
border-right-color: #D3D3D3;
vertical-align: bottom;
padding-top: 5px;
padding-bottom: 6px;
padding-left: 5px;
padding-right: 5px;
overflow-x: hidden;
}
#rbwdbghsmn .gt_column_spanner_outer {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
font-weight: normal;
text-transform: inherit;
padding-top: 0;
padding-bottom: 0;
padding-left: 4px;
padding-right: 4px;
}
#rbwdbghsmn .gt_column_spanner_outer:first-child {
padding-left: 0;
}
#rbwdbghsmn .gt_column_spanner_outer:last-child {
padding-right: 0;
}
#rbwdbghsmn .gt_column_spanner {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
vertical-align: bottom;
padding-top: 5px;
padding-bottom: 5px;
overflow-x: hidden;
display: inline-block;
width: 100%;
}
#rbwdbghsmn .gt_spanner_row {
border-bottom-style: hidden;
}
#rbwdbghsmn .gt_group_heading {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
padding-right: 5px;
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
font-weight: initial;
text-transform: inherit;
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
border-left-style: none;
border-left-width: 1px;
border-left-color: #D3D3D3;
border-right-style: none;
border-right-width: 1px;
border-right-color: #D3D3D3;
vertical-align: middle;
text-align: left;
}
#rbwdbghsmn .gt_empty_group_heading {
padding: 0.5px;
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
font-weight: initial;
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
vertical-align: middle;
}
#rbwdbghsmn .gt_from_md > :first-child {
margin-top: 0;
}
#rbwdbghsmn .gt_from_md > :last-child {
margin-bottom: 0;
}
#rbwdbghsmn .gt_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
padding-right: 5px;
margin: 10px;
border-top-style: solid;
border-top-width: 1px;
border-top-color: #D3D3D3;
border-left-style: none;
border-left-width: 1px;
border-left-color: #D3D3D3;
border-right-style: none;
border-right-width: 1px;
border-right-color: #D3D3D3;
vertical-align: middle;
overflow-x: hidden;
}
#rbwdbghsmn .gt_stub {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
font-weight: initial;
text-transform: inherit;
border-right-style: solid;
border-right-width: 2px;
border-right-color: #D3D3D3;
padding-left: 5px;
padding-right: 5px;
}
#rbwdbghsmn .gt_stub_row_group {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
font-weight: initial;
text-transform: inherit;
border-right-style: solid;
border-right-width: 2px;
border-right-color: #D3D3D3;
padding-left: 5px;
padding-right: 5px;
vertical-align: top;
}
#rbwdbghsmn .gt_row_group_first td {
border-top-width: 2px;
}
#rbwdbghsmn .gt_row_group_first th {
border-top-width: 2px;
}
#rbwdbghsmn .gt_summary_row {
color: #333333;
background-color: #FFFFFF;
text-transform: inherit;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
padding-right: 5px;
}
#rbwdbghsmn .gt_first_summary_row {
border-top-style: solid;
border-top-color: #D3D3D3;
}
#rbwdbghsmn .gt_first_summary_row.thick {
border-top-width: 2px;
}
#rbwdbghsmn .gt_last_summary_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
padding-right: 5px;
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
}
#rbwdbghsmn .gt_grand_summary_row {
color: #333333;
background-color: #FFFFFF;
text-transform: inherit;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
padding-right: 5px;
}
#rbwdbghsmn .gt_first_grand_summary_row {
padding-top: 8px;