PageSourceSearch

https://ds002r-fds.netlify.app/r-tip

html ds002r-fds.netlify.app collected 2026-10-03 10:40:18 UTC 42,344 bytes, 1,232 lines download raw bytes

1<!DOCTYPE html>
2<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
3
4<meta charset="utf-8">
5<!-- This site is hosted on Netlify. Anyone can build and deploy a site
6     like this one for free: https://netlify.new/?utm_campaign=loops&utm_source=ai-legible&utm_medium=owned&utm_content=comment&utm_id=74fbad81-f871-4252-8909-44cabbc5f594
7     Netlify hosting facts for this site: static/SSR served via Netlify Edge. -->
8<meta name="generator" content="quarto-1.10.18">
9
10<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
11
12<meta name="description" content="So many awesome ways to do R in Positron. I’ll share some, you’ll share some, it will be fun.">
13
14<title>R / Positron tip-of-the-day – Foundations of Data Science in R</title>
15<style>
16/* Default styles provided by pandoc.
17** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
18*/
19span.smallcaps{font-variant: small-caps;}
20div.columns{display: flex; gap: 1.5em;}
21div.column{flex: auto;}
22@media screen {
23div.columns{gap: min(4vw, 1.5em);}
24div.column{overflow-x: auto;}
25}
26div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
27ul.task-list{list-style: none;}
28ul.task-list li input[type="checkbox"] {
29  width: 0.8em;
30  margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ 
31  vertical-align: middle;
32}
33</style>
34
35
36<script src="site_libs/quarto-nav/quarto-nav.js"></script>
vendor: 1 bytes, line 36
36
37<script src="site_libs/quarto-nav/headroom.min.js"></script>
vendor: 1 bytes, line 37
37
38<script src="site_libs/clipboard/clipboard.min.js"></script>
vendor: 1 bytes, line 38
38
39<script src="site_libs/quarto-search/autocomplete.umd.js"></script>
vendor: 1 bytes, line 39
39
40<script src="site_libs/quarto-search/fuse.min.js"></script>
vendor: 1 bytes, line 40
40
41<script src="site_libs/quarto-search/quarto-search.js"></script>
41
42<meta name="quarto:offset" content="./">
43<link href="./images/favicon.ico" rel="icon">
44<script src="site_libs/quarto-html/quarto.js" type="module"></script>
vendor: 1 bytes, line 44
44
45<script src="site_libs/quarto-html/tabsets/tabsets.js" type="module"></script>
vendor: 1 bytes, line 45
45
46<script src="site_libs/quarto-html/popper.min.js"></script>
vendor: 1 bytes, line 46
46
47<script src="site_libs/quarto-html/tippy.umd.min.js"></script>
vendor: 1 bytes, line 47
47
48<script src="site_libs/quarto-html/anchor.min.js"></script>
48
49<link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
50<link href="site_libs/quarto-html/quarto-syntax-highlighting-64a204ab8560d761af7679ceaba22944.css" rel="stylesheet" id="quarto-text-highlighting-styles">
51<script src="site_libs/bootstrap/bootstrap.min.js"></script>
51
52<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
53<link href="site_libs/bootstrap/bootstrap-a8111dbb49da88347f07f358db18fe74.min.css" rel="stylesheet" append-hash="true" id="quarto-bootstrap" data-mode="light">
54<link href="site_libs/quarto-contrib/fontawesome6-1.2.0/all.min.css" rel="stylesheet">
55<link href="site_libs/quarto-contrib/fontawesome6-1.2.0/latex-fontsize.css" rel="stylesheet">
56<script id="quarto-search-options" type="application/json">{
57  "location": "navbar",
58  "copy-button": false,
59  "collapse-after": 3,
60  "panel-placement": "end",
61  "type": "overlay",
62  "limit": 50,
63  "keyboard-shortcut": [
64    "f",
65    "/",
66    "s"
67  ],
68  "show-item-context": false,
69  "language": {
70    "search-no-results-text": "No results",
71    "search-matching-documents-text": "matching documents",
72    "search-copy-link-title": "Copy link to search",
73    "search-hide-matches-text": "Hide additional matches",
74    "search-more-match-text": "more match in this document",
75    "search-more-matches-text": "more matches in this document",
76    "search-clear-button-title": "Clear",
77    "search-text-placeholder": "",
78    "search-detached-cancel-button-title": "Cancel",
79    "search-submit-button-title": "Submit",
80    "search-label": "Search"
81  }
82}</script>
82
83
84
85</head>
86
87<body class="nav-fixed fullcontent quarto-light">
88
89<div id="quarto-search-results"></div>
90  <header id="quarto-header" class="headroom fixed-top">
91    <nav class="navbar navbar-expand-lg " data-bs-theme="dark">
92      <div class="navbar-container container-fluid">
93      <div class="navbar-brand-container mx-auto">
94    <a href="https://ds002r-fds.netlify.app/" class="navbar-brand navbar-brand-logo">
95    <img src="./images/st47s.png" alt="" class="navbar-logo light-content">
96    <img src="./images/st47s.png" alt="" class="navbar-logo dark-content">
97    </a>
98    <a class="navbar-brand" href="https://ds002r-fds.netlify.app/">
99    <span class="navbar-title">Foundations of Data Science in R</span>
100    </a>
101  </div>
102            <div id="quarto-search" class="" title="Search"></div>
103          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
104  <span class="navbar-toggler-icon"></span>
105</button>
106          <div class="collapse navbar-collapse" id="navbarCollapse">
107            <ul class="navbar-nav navbar-nav-scroll ms-auto">
108  <li class="nav-item">
109    <a class='nav-link' href='/syllabus'> 
110<span class="menu-text">Syllabus</span></a>
111  </li>  
112  <li class="nav-item">
113    <a class='nav-link' href='/notes'> 
114<span class="menu-text">Class Notes</span></a>
115  </li>  
116  <li class="nav-item">
117    <a class='nav-link' href='/clicker_study'> 
118<span class="menu-text">Clicker Q</span></a>
119  </li>  
120  <li class="nav-item">
121    <a aria-current='page' class='nav-link active' href='/r-tip'> 
122<span class="menu-text">R tip</span></a>
123  </li>  
124  <li class="nav-item">
125    <a class='nav-link' href='/endangered_data'> 
126<span class="menu-text">Endangered Data</span></a>
127  </li>  
128  <li class="nav-item dropdown ">
129    <a class="nav-link dropdown-toggle" href="#" id="nav-menu-project" role="link" data-bs-toggle="dropdown" aria-expanded="false">
130 <span class="menu-text">Project</span>
131    </a>
132    <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="nav-menu-project">    
133        <li>
134    <a class='dropdown-item' href='/project'>
135 <span class="dropdown-text">semester mini-projects</span></a>
136  </li>  
137        <li>
138    <a class='dropdown-item' href='/project1'>
139 <span class="dropdown-text">project 1 - website</span></a>
140  </li>  
141        <li>
142    <a class="dropdown-item" href="./project2.html">
143 <span class="dropdown-text">project 2 - text analysis</span></a>
144  </li>  
145        <li>
146    <a class="dropdown-item" href="./project3.html">
147 <span class="dropdown-text">project 3 - simulation</span></a>
148  </li>  
149        <li>
150    <a class="dropdown-item" href="./project4.html">
151 <span class="dropdown-text">project 4 - ethics</span></a>
152  </li>  
153        <li>
154    <a class="dropdown-item" href="./project5.html">
155 <span class="dropdown-text">project 5 - SQL</span></a>
156  </li>  
157        <li>
158    <a class="dropdown-item" href="./project6.html">
159 <span class="dropdown-text">project 6 - fin</span></a>
160  </li>  
161        <li>
162    <a class="dropdown-item" href="https://hardin47.netlify.app/courses/data/">
163 <span class="dropdown-text">Data Sources</span></a>
164  </li>  
165    </ul>
166  </li>
167  <li class="nav-item">
168    <a class='nav-link' href='/github'> 
169<span class="menu-text">GitHub</span></a>
170  </li>  
171</ul>
172          </div> <!-- /navcollapse -->
173            <div class="quarto-navbar-tools">
174</div>
175      </div> <!-- /container-fluid -->
176    </nav>
177</header>
178<!-- content -->
179<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
180<!-- sidebar -->
181<!-- margin-sidebar -->
182    
183<!-- main -->
184<main class="content page-columns page-full" id="quarto-document-content">
185
186<header id="title-block-header" class="quarto-title-block default">
187<div class="quarto-title">
188<h1 class="title">R / Positron tip-of-the-day</h1>
189</div>
190
191<div>
192  <div class="description">
193    <p>So many awesome ways to do R in Positron. I’ll share some, you’ll share some, it will be fun.</p>
194  </div>
195</div>
196
197
198<div class="quarto-title-meta">
199
200    
201  
202    
203  </div>
204  
205
206
207</header>
208
209
210<aside>
211<div class="cell" data-preview="true">
212<div class="cell-output-display">
213<div class="quarto-figure quarto-figure-center">
214<figure class="figure">
215<p><img src="images/R_first_then.png" class="img-fluid figure-img" alt="At first R and the monster are in a storm, very unhappy. Then R and the monster are happy in the sunshine." width="300"></p>
216<figcaption>Artwork by <span class="citation" data-cites="allison_horst">@allison_horst</span>.</figcaption>
217</figure>
218</div>
219</div>
220</div>
221</aside>
222<div class="cell page-columns page-full">
223<div class="cell-output-display column-body-outset">
224<div id="lgdbbpbiwx" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
225<style>#lgdbbpbiwx table {
226  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
227  -webkit-font-smoothing: antialiased;
228  -moz-osx-font-smoothing: grayscale;
229}
230
231#lgdbbpbiwx thead, #lgdbbpbiwx tbody, #lgdbbpbiwx tfoot, #lgdbbpbiwx tr, #lgdbbpbiwx td, #lgdbbpbiwx th {
232  border-style: none;
233}
234
235#lgdbbpbiwx p {
236  margin: 0;
237  padding: 0;
238}
239
240#lgdbbpbiwx .gt_table {
241  display: table;
242  border-collapse: collapse;
243  line-height: normal;
244  margin-left: auto;
245  margin-right: auto;
246  color: #333333;
247  font-size: 16px;
248  font-weight: normal;
249  font-style: normal;
250  background-color: #FFFFFF;
251  width: auto;
252  border-top-style: solid;
253  border-top-width: 2px;
254  border-top-color: #A8A8A8;
255  border-right-style: none;
256  border-right-width: 2px;
257  border-right-color: #D3D3D3;
258  border-bottom-style: solid;
259  border-bottom-width: 2px;
260  border-bottom-color: #A8A8A8;
261  border-left-style: none;
262  border-left-width: 2px;
263  border-left-color: #D3D3D3;
264}
265
266#lgdbbpbiwx .gt_caption {
267  padding-top: 4px;
268  padding-bottom: 4px;
269}
270
271#lgdbbpbiwx .gt_title {
272  color: #333333;
273  font-size: 125%;
274  font-weight: initial;
275  padding-top: 4px;
276  padding-bottom: 4px;
277  padding-left: 5px;
278  padding-right: 5px;
279  border-bottom-color: #FFFFFF;
280  border-bottom-width: 0;
281}
282
283#lgdbbpbiwx .gt_subtitle {
284  color: #333333;
285  font-size: 85%;
286  font-weight: initial;
287  padding-top: 3px;
288  padding-bottom: 5px;
289  padding-left: 5px;
290  padding-right: 5px;
291  border-top-color: #FFFFFF;
292  border-top-width: 0;
293}
294
295#lgdbbpbiwx .gt_heading {
296  background-color: #FFFFFF;
297  text-align: center;
298  border-bottom-color: #FFFFFF;
299  border-left-style: none;
300  border-left-width: 1px;
301  border-left-color: #D3D3D3;
302  border-right-style: none;
303  border-right-width: 1px;
304  border-right-color: #D3D3D3;
305}
306
307#lgdbbpbiwx .gt_bottom_border {
308  border-bottom-style: solid;
309  border-bottom-width: 2px;
310  border-bottom-color: #D3D3D3;
311}
312
313#lgdbbpbiwx .gt_col_headings {
314  border-top-style: solid;
315  border-top-width: 2px;
316  border-top-color: #D3D3D3;
317  border-bottom-style: solid;
318  border-bottom-width: 2px;
319  border-bottom-color: #D3D3D3;
320  border-left-style: none;
321  border-left-width: 1px;
322  border-left-color: #D3D3D3;
323  border-right-style: none;
324  border-right-width: 1px;
325  border-right-color: #D3D3D3;
326}
327
328#lgdbbpbiwx .gt_col_heading {
329  color: #333333;
330  background-color: #FFFFFF;
331  font-size: 100%;
332  font-weight: normal;
333  text-transform: inherit;
334  border-left-style: none;
335  border-left-width: 1px;
336  border-left-color: #D3D3D3;
337  border-right-style: none;
338  border-right-width: 1px;
339  border-right-color: #D3D3D3;
340  vertical-align: bottom;
341  padding-top: 5px;
342  padding-bottom: 6px;
343  padding-left: 5px;
344  padding-right: 5px;
345  overflow-x: hidden;
346}
347
348#lgdbbpbiwx .gt_column_spanner_outer {
349  color: #333333;
350  background-color: #FFFFFF;
351  font-size: 100%;
352  font-weight: normal;
353  text-transform: inherit;
354  padding-top: 0;
355  padding-bottom: 0;
356  padding-left: 4px;
357  padding-right: 4px;
358}
359
360#lgdbbpbiwx .gt_column_spanner_outer:first-child {
361  padding-left: 0;
362}
363
364#lgdbbpbiwx .gt_column_spanner_outer:last-child {
365  padding-right: 0;
366}
367
368#lgdbbpbiwx .gt_column_spanner {
369  border-bottom-style: solid;
370  border-bottom-width: 2px;
371  border-bottom-color: #D3D3D3;
372  vertical-align: bottom;
373  padding-top: 5px;
374  padding-bottom: 5px;
375  overflow-x: hidden;
376  display: inline-block;
377  width: 100%;
378}
379
380#lgdbbpbiwx .gt_spanner_row {
381  border-bottom-style: hidden;
382}
383
384#lgdbbpbiwx .gt_group_heading {
385  padding-top: 8px;
386  padding-bottom: 8px;
387  padding-left: 5px;
388  padding-right: 5px;
389  color: #333333;
390  background-color: #FFFFFF;
391  font-size: 100%;
392  font-weight: initial;
393  text-transform: inherit;
394  border-top-style: solid;
395  border-top-width: 2px;
396  border-top-color: #D3D3D3;
397  border-bottom-style: solid;
398  border-bottom-width: 2px;
399  border-bottom-color: #D3D3D3;
400  border-left-style: none;
401  border-left-width: 1px;
402  border-left-color: #D3D3D3;
403  border-right-style: none;
404  border-right-width: 1px;
405  border-right-color: #D3D3D3;
406  vertical-align: middle;
407  text-align: left;
408}
409
410#lgdbbpbiwx .gt_empty_group_heading {
411  padding: 0.5px;
412  color: #333333;
413  background-color: #FFFFFF;
414  font-size: 100%;
415  font-weight: initial;
416  border-top-style: solid;
417  border-top-width: 2px;
418  border-top-color: #D3D3D3;
419  border-bottom-style: solid;
420  border-bottom-width: 2px;
421  border-bottom-color: #D3D3D3;
422  vertical-align: middle;
423}
424
425#lgdbbpbiwx .gt_from_md > :first-child {
426  margin-top: 0;
427}
428
429#lgdbbpbiwx .gt_from_md > :last-child {
430  margin-bottom: 0;
431}
432
433#lgdbbpbiwx .gt_row {
434  padding-top: 8px;
435  padding-bottom: 8px;
436  padding-left: 5px;
437  padding-right: 5px;
438  margin: 10px;
439  border-top-style: solid;
440  border-top-width: 1px;
441  border-top-color: #D3D3D3;
442  border-left-style: none;
443  border-left-width: 1px;
444  border-left-color: #D3D3D3;
445  border-right-style: none;
446  border-right-width: 1px;
447  border-right-color: #D3D3D3;
448  vertical-align: middle;
449  overflow-x: hidden;
450}
451
452#lgdbbpbiwx .gt_stub {
453  color: #333333;
454  background-color: #FFFFFF;
455  font-size: 100%;
456  font-weight: initial;
457  text-transform: inherit;
458  border-right-style: solid;
459  border-right-width: 2px;
460  border-right-color: #D3D3D3;
461  padding-left: 5px;
462  padding-right: 5px;
463}
464
465#lgdbbpbiwx .gt_stub_row_group {
466  color: #333333;
467  background-color: #FFFFFF;
468  font-size: 100%;
469  font-weight: initial;
470  text-transform: inherit;
471  border-right-style: solid;
472  border-right-width: 2px;
473  border-right-color: #D3D3D3;
474  padding-left: 5px;
475  padding-right: 5px;
476  vertical-align: top;
477}
478
479#lgdbbpbiwx .gt_row_group_first td {
480  border-top-width: 2px;
481}
482
483#lgdbbpbiwx .gt_row_group_first th {
484  border-top-width: 2px;
485}
486
487#lgdbbpbiwx .gt_summary_row {
488  color: #333333;
489  background-color: #FFFFFF;
490  text-transform: inherit;
491  padding-top: 8px;
492  padding-bottom: 8px;
493  padding-left: 5px;
494  padding-right: 5px;
495}
496
497#lgdbbpbiwx .gt_first_summary_row {
498  border-top-style: solid;
499  border-top-color: #D3D3D3;
500}
501
502#lgdbbpbiwx .gt_first_summary_row.thick {
503  border-top-width: 2px;
504}
505
506#lgdbbpbiwx .gt_last_summary_row {
507  padding-top: 8px;
508  padding-bottom: 8px;
509  padding-left: 5px;
510  padding-right: 5px;
511  border-bottom-style: solid;
512  border-bottom-width: 2px;
513  border-bottom-color: #D3D3D3;
514}
515
516#lgdbbpbiwx .gt_grand_summary_row {
517  color: #333333;
518  background-color: #FFFFFF;
519  text-transform: inherit;
520  padding-top: 8px;
521  padding-bottom: 8px;
522  padding-left: 5px;
523  padding-right: 5px;
524}
525
526#lgdbbpbiwx .gt_first_grand_summary_row {
527  padding-top: 8px;
528  padding-bottom: 8px;
529  padding-left: 5px;
530  padding-right: 5px;
531  border-top-style: double;
532  border-top-width: 6px;
533  border-top-color: #D3D3D3;
534}
535
536#lgdbbpbiwx .gt_last_grand_summary_row_top {
537  padding-top: 8px;
538  padding-bottom: 8px;
539  padding-left: 5px;
540  padding-right: 5px;
541  border-bottom-style: double;
542  border-bottom-width: 6px;
543  border-bottom-color: #D3D3D3;
544}
545
546#lgdbbpbiwx .gt_striped {
547  background-color: rgba(128, 128, 128, 0.05);
548}
549
550#lgdbbpbiwx .gt_table_body {
551  border-top-style: solid;
552  border-top-width: 2px;
553  border-top-color: #D3D3D3;
554  border-bottom-style: solid;
555  border-bottom-width: 2px;
556  border-bottom-color: #D3D3D3;
557}
558
559#lgdbbpbiwx .gt_footnotes {
560  color: #333333;
561  background-color: #FFFFFF;
562  border-bottom-style: none;
563  border-bottom-width: 2px;
564  border-bottom-color: #D3D3D3;
565  border-left-style: none;
566  border-left-width: 2px;
567  border-left-color: #D3D3D3;
568  border-right-style: none;
569  border-right-width: 2px;
570  border-right-color: #D3D3D3;
571}
572
573#lgdbbpbiwx .gt_footnote {
574  margin: 0px;
575  font-size: 90%;
576  padding-top: 4px;
577  padding-bottom: 4px;
578  padding-left: 5px;
579  padding-right: 5px;
580}
581
582#lgdbbpbiwx .gt_sourcenotes {
583  color: #333333;
584  background-color: #FFFFFF;
585  border-bottom-style: none;
586  border-bottom-width: 2px;
587  border-bottom-color: #D3D3D3;
588  border-left-style: none;
589  border-left-width: 2px;
590  border-left-color: #D3D3D3;
591  border-right-style: none;
592  border-right-width: 2px;
593  border-right-color: #D3D3D3;
594}
595
596#lgdbbpbiwx .gt_sourcenote {
597  font-size: 90%;
598  padding-top: 4px;
599  padding-bottom: 4px;
600  padding-left: 5px;
601  padding-right: 5px;
602}
603
604#lgdbbpbiwx .gt_left {
605  text-align: left;
606}
607
608#lgdbbpbiwx .gt_center {
609  text-align: center;
610}
611
612#lgdbbpbiwx .gt_right {
613  text-align: right;
614  font-variant-numeric: tabular-nums;
615}
616
617#lgdbbpbiwx .gt_font_normal {
618  font-weight: normal;
619}
620
621#lgdbbpbiwx .gt_font_bold {
622  font-weight: bold;
623}
624
625#lgdbbpbiwx .gt_font_italic {
626  font-style: italic;
627}
628
629#lgdbbpbiwx .gt_super {
630  font-size: 65%;
631}
632
633#lgdbbpbiwx .gt_footnote_marks {
634  font-size: 75%;
635  vertical-align: 0.4em;
636  position: initial;
637}
638
639#lgdbbpbiwx .gt_asterisk {
640  font-size: 100%;
641  vertical-align: 0;
642}
643
644#lgdbbpbiwx .gt_indent_1 {
645  text-indent: 5px;
646}
647
648#lgdbbpbiwx .gt_indent_2 {
649  text-indent: 10px;
650}
651
652#lgdbbpbiwx .gt_indent_3 {
653  text-indent: 15px;
654}
655
656#lgdbbpbiwx .gt_indent_4 {
657  text-indent: 20px;
658}
659
660#lgdbbpbiwx .gt_indent_5 {
661  text-indent: 25px;
662}
663
664#lgdbbpbiwx .katex-display {
665  display: inline-flex !important;
666  margin-bottom: 0.75em !important;
667}
668
669#lgdbbpbiwx div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
670  height: 0px !important;
671}
672</style>
673
674<table class="gt_table caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
675<thead>
676<tr class="gt_col_headings header">
677<th id="number" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">number</th>
678<th id="tip" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">tip</th>
679<th id="description" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">description</th>
680<th id="misc" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">misc</th>
681</tr>
682</thead>
683<tbody class="gt_table_body">
684<tr class="odd">
685<td class="gt_row gt_left" headers="number">Tip 1</td>
686<td class="gt_row gt_left" headers="tip">cmd + shift + P</td>
687<td class="gt_row gt_left" headers="description">Command Palette - does everything</td>
688<td class="gt_row gt_left" headers="misc">cntrl + shift + P for Windows</td>
689</tr>
690<tr class="even">
691<td class="gt_row gt_left" headers="number">Tip 2</td>
692<td class="gt_row gt_left" headers="tip">color = “#4CBB17” (kelly green!)</td>
693<td class="gt_row gt_left" headers="description">in <code>ggplot2</code> use any color</td>
694<td class="gt_row gt_left" headers="misc"></td>
695</tr>
696<tr class="odd">
697<td class="gt_row gt_left" headers="number">Tip 3</td>
698<td class="gt_row gt_left" headers="tip"><code>geom_bar()</code> vs <code>geom_col()</code></td>
699<td class="gt_row gt_left" headers="description">no <code>y</code> variable in <code>geom_bar()</code></td>
700<td class="gt_row gt_left" headers="misc"><code>geom_bar()</code> does the counting for you</td>
701</tr>
702<tr class="even">
703<td class="gt_row gt_left" headers="number">Tip 4</td>
704<td class="gt_row gt_left" headers="tip"><code>position = "dodge"</code></td>
705<td class="gt_row gt_left" headers="description">use to show information that overlaps</td>
706<td class="gt_row gt_left" headers="misc">available in many <code>geom_*()</code> functions</td>
707</tr>
708<tr class="odd">
709<td class="gt_row gt_left" headers="number">Tip 5</td>
710<td class="gt_row gt_left" headers="tip">keyboard up arrow</td>
711<td class="gt_row gt_left" headers="description">brings back the previous line</td>
712<td class="gt_row gt_left" headers="misc">works in Console or Terminal</td>
713</tr>
714<tr class="even">
715<td class="gt_row gt_left" headers="number">Tip 6</td>
716<td class="gt_row gt_left" headers="tip">highlight code + cmd + enter</td>
717<td class="gt_row gt_left" headers="description">will run only the highlighted code</td>
718<td class="gt_row gt_left" headers="misc">highlight code + cntrl + enter on Windows</td>
719</tr>
720<tr class="odd">
721<td class="gt_row gt_left" headers="number">Tip 7</td>
722<td class="gt_row gt_left" headers="tip"><code>scales = "free"</code></td>
723<td class="gt_row gt_left" headers="description">inside <code>facet_grid()</code> or <code>facet_wrap()</code> for allowing variable axes</td>
724<td class="gt_row gt_left" headers="misc">also options of <code>"free_x"</code> or <code>
724"free_y"</code></td>
725</tr>
726<tr class="even">
727<td class="gt_row gt_left" headers="number">Tip 8</td>
728<td class="gt_row gt_left" headers="tip"><code>+ labs(shape = "The Species", color = "The Species")</code></td>
729<td class="gt_row gt_left" headers="description">change the label in <code>ggplot</code> for two aspects for the same label</td>
730<td class="gt_row gt_left" headers="misc"></td>
731</tr>
732<tr class="odd">
733<td class="gt_row gt_left" headers="number">Tip 9</td>
734<td class="gt_row gt_left" headers="tip"><code>+ scale_shape_manual(values = c("IL" = 16, "IN" = 17, "MI" = 15, "OH" = 18, "WI" = 7))</code></td>
735<td class="gt_row gt_left" headers="description">manually change the plotting symbol</td>
736<td class="gt_row gt_left" headers="misc">alternatively: <code>scale_shape_manual(values = c(16, 17, 15, 18, 7))</code></td>
737</tr>
738<tr class="even">
739<td class="gt_row gt_left" headers="number">Tip 10</td>
740<td class="gt_row gt_left" headers="tip"><code>+ labs(title = "Here is a super long title\n that I want on two lines.")</code></td>
741<td class="gt_row gt_left" headers="description"><code>\n</code> to linebreak the title</td>
742<td class="gt_row gt_left" headers="misc"></td>
743</tr>
744<tr class="odd">
745<td class="gt_row gt_left" headers="number">Tip 11</td>
746<td class="gt_row gt_left" headers="tip">cmd + shift + m</td>
747<td class="gt_row gt_left" headers="description">shortcut for the pipe, <code>|&gt;</code></td>
748<td class="gt_row gt_left" headers="misc">cntrl + shift + m on Windows</td>
749</tr>
750<tr class="even">
751<td class="gt_row gt_left" headers="number">Tip 12</td>
752<td class="gt_row gt_left" headers="tip">opt + dash</td>
753<td class="gt_row gt_left" headers="description">shortcut for the assignment, <code>&lt;-</code></td>
754<td class="gt_row gt_left" headers="misc">alt + dash on Windows</td>
755</tr>
756<tr class="odd">
757<td class="gt_row gt_left" headers="number">Tip 13</td>
758<td class="gt_row gt_left" headers="tip"><code>count()</code> counts items in groups</td>
759<td class="gt_row gt_left" headers="description">not used inside a tidy verb</td>
760<td class="gt_row gt_left" headers="misc">e.g., <code>penguins |&gt; count(island)</code></td>
761</tr>
762<tr class="even">
763<td class="gt_row gt_left" headers="number">Tip 14</td>
764<td class="gt_row gt_left" headers="tip">need <code>&amp;</code> with filter if you use <code>|</code></td>
765<td class="gt_row gt_left" headers="description">comma is a shortcut for and, unless you also have or</td>
766<td class="gt_row gt_left" headers="misc"></td>
767</tr>
768<tr class="odd">
769<td class="gt_row gt_left" headers="number">Tip 15</td>
770<td class="gt_row gt_left" headers="tip">cntrl + L</td>
771<td class="gt_row gt_left" headers="description">clears the console</td>
772<td class="gt_row gt_left" headers="misc">e.g., if you do not like looking at the error messages</td>
773</tr>
774<tr class="even">
775<td class="gt_row gt_left" headers="number">Tip 16</td>
776<td class="gt_row gt_left" headers="tip"><code>unique()</code></td>
777<td class="gt_row gt_left" headers="description">gives the unique values in a variable, cannot be used in a tidy pipeline</td>
778<td class="gt_row gt_left" headers="misc">instead: `penguins |&gt; distinct(species)</td>
779</tr>
780<tr class="odd">
781<td class="gt_row gt_left" headers="number">Tip 17</td>
782<td class="gt_row gt_left" headers="tip">highlight code + cmd + shift + c</td>
783<td class="gt_row gt_left" headers="description">comments lines to not render</td>
784<td class="gt_row gt_left" headers="misc">cntl + shift + c on Windows</td>
785</tr>
786<tr class="even">
787<td class="gt_row gt_left" headers="number">Tip 18</td>
788<td class="gt_row gt_left" headers="tip"><code>alpha = 0.4</code></td>
789<td class="gt_row gt_left" headers="description">makes the plot item (e.g., point) transparent, e.g., 40% of the ink</td>
790<td class="gt_row gt_left" headers="misc">can be used in <code>geom_point()</code>, <code>geom_text()</code>, and other geoms</td>
791</tr>
792<tr class="odd">
793<td class="gt_row gt_left" headers="number">Tip 19</td>
794<td class="gt_row gt_left" headers="tip">highlight code + cmd + [ (or highlight code + cmd + [)</td>
795<td class="gt_row gt_left" headers="description">shifts the code left (or right)</td>
796<td class="gt_row gt_left" headers="misc">highlight code + cntrl + [ on Windows</td>
797</tr>
798</tbody>
799</table>
800
801</div>
802</div>
803</div>
804
805
806
807<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div>CC-BY-SA-4.0</div></div></section></div></main> <!-- /main -->
808<script id="quarto-html-after-body" type="application/javascript">
809  window.document.addEventListener("DOMContentLoaded", function (event) {
810    const icon = "";
811    const anchorJS = new window.AnchorJS();
812    anchorJS.options = {
813      placement: 'right',
814      icon: icon
815    };
816    anchorJS.add('.anchored');
817    const isCodeAnnotation = (el) => {
818      for (const clz of el.classList) {
819        if (clz.startsWith('code-annotation-')) {                     
820          return true;
821        }
822      }
823      return false;
824    }
825    const onCopySuccess = function(e) {
826      // button target
827      const button = e.trigger;
828      // don't keep focus
829      button.blur();
830      // flash "checked"
831      button.classList.add('code-copy-button-checked');
832      var currentTitle = button.getAttribute("title");
833      button.setAttribute("title", "Copied!");
834      let tooltip;
835      if (window.bootstrap) {
836        button.setAttribute("data-bs-toggle", "tooltip");
837        button.setAttribute("data-bs-placement", "left");
838        button.setAttribute("data-bs-title", "Copied!");
839        tooltip = new bootstrap.Tooltip(button, 
840          { trigger: "manual", 
841            customClass: "code-copy-button-tooltip",
842            offset: [0, -8]});
843        tooltip.show();    
844      }
845      setTimeout(function() {
846        if (tooltip) {
847          tooltip.hide();
848          button.removeAttribute("data-bs-title");
849          button.removeAttribute("data-bs-toggle");
850          button.removeAttribute("data-bs-placement");
851        }
852        button.setAttribute("title", currentTitle);
853        button.classList.remove('code-copy-button-checked');
854      }, 1000);
855      // clear code selection
856      e.clearSelection();
857    }
858    const getTextToCopy = function(trigger) {
859      const outerScaffold = trigger.parentElement.cloneNode(true);
860      const codeEl = outerScaffold.querySelector('code');
861      for (const childEl of codeEl.children) {
862        if (isCodeAnnotation(childEl)) {
863          childEl.remove();
864        }
865      }
866      return codeEl.innerText;
867    }
868    const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
869      text: getTextToCopy
870    });
871    clipboard.on('success', onCopySuccess);
872    if (window.document.getElementById('quarto-embedded-source-code-modal')) {
873      const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
874        text: getTextToCopy,
875        container: window.document.getElementById('quarto-embedded-source-code-modal')
876      });
877      clipboardModal.on('success', onCopySuccess);
878    }
879      var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
880      var mailtoRegex = new RegExp(/^mailto:/);
881        var filterRegex = new RegExp("https:\/\/ds002r-fds\.netlify\.app\/");
882      var isInternal = (href) => {
883          return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
884      }
885      // Inspect non-navigation links and adorn them if external
886     var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
887      for (var i=0; i<links.length; i++) {
888        const link = links[i];
889        if (!isInternal(link.href)) {
890          // undo the damage that might have been done by quarto-nav.js in the case of
891          // links that we want to consider external
892          if (link.dataset.originalHref !== undefined) {
893            link.href = link.dataset.originalHref;
894          }
895        }
896      }
897    function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
898      const config = {
899        allowHTML: true,
900        maxWidth: 500,
901        delay: 100,
902        arrow: false,
903        appendTo: function(el) {
904            return el.parentElement;
905        },
906        interactive: true,
907        interactiveBorder: 10,
908        theme: 'quarto',
909        placement: 'bottom-start',
910      };
911      if (contentFn) {
912        config.content = contentFn;
913      }
914      if (onTriggerFn) {
915        config.onTrigger = onTriggerFn;
916      }
917      if (onUntriggerFn) {
918        config.onUntrigger = onUntriggerFn;
919      }
920      window.tippy(el, config); 
921    }
922    const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
923    for (var i=0; i<noterefs.length; i++) {
924      const ref = noterefs[i];
925      tippyHover(ref, function() {
926        // use id or data attribute instead here
927        let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
928        try { href = new URL(href).hash; } catch {}
929        const id = href.replace(/^#\/?/, "");
930        const note = window.document.getElementById(id);
931        if (note) {
932          return note.innerHTML;
933        } else {
934          return "";
935        }
936      });
937    }
938    const xrefs = window.document.querySelectorAll('a.quarto-xref');
939    const processXRef = (id, note) => {
940      // Strip column container classes
941      const stripColumnClz = (el) => {
942        el.classList.remove("page-full", "page-columns");
943        if (el.children) {
944          for (const child of el.children) {
945            stripColumnClz(child);
946          }
947        }
948      }
949      stripColumnClz(note)
950      if (id === null || id.startsWith('sec-')) {
951        // Special case sections, only their first couple elements
952        const container = document.createElement("div");
953        if (note.children && note.children.length > 2) {
954          container.appendChild(note.children[0].cloneNode(true));
955          for (let i = 1; i < note.children.length; i++) {
956            const child = note.children[i];
957            if (child.tagName === "P" && child.innerText === "") {
958              continue;
959            } else {
960              container.appendChild(child.cloneNode(true));
961              break;
962            }
963          }
964          if (window.Quarto?.typesetMath) {
965            window.Quarto.typesetMath(container);
966          }
967          return container.innerHTML
968        } else {
969          if (window.Quarto?.typesetMath) {
970            window.Quarto.typesetMath(note);
971          }
972          return note.innerHTML;
973        }
974      } else {
975        // Remove any anchor links if they are present
976        const anchorLink = note.querySelector('a.anchorjs-link');
977        if (anchorLink) {
978          anchorLink.remove();
979        }
980        if (window.Quarto?.typesetMath) {
981          window.Quarto.typesetMath(note);
982        }
983        if (note.classList.contains("callout")) {
984          return note.outerHTML;
985        } else {
986          return note.innerHTML;
987        }
988      }
989    }
990    for (var i=0; i<xrefs.length; i++) {
991      const xref = xrefs[i];
992      tippyHover(xref, undefined, function(instance) {
993        instance.disable();
994        let url = xref.getAttribute('href');
995        let hash = undefined; 
996        if (url.startsWith('#')) {
997          hash = url;
998        } else {
999          try { hash = new URL(url).hash; } catch {}
1000        }
1001        if (hash) {
1002          const id = hash.replace(/^#\/?/, "");
1003          const note = window.document.getElementById(id);
1004          if (note !== null) {
1005            try {
1006              const html = processXRef(id, note.cloneNode(true));
1007              instance.setContent(html);
1008            } finally {
1009              instance.enable();
1010              instance.show();
1011            }
1012          } else {
1013            // See if we can fetch this
1014            fetch(url.split('#')[0])
1015            .then(res => res.text())
1016            .then(html => {
1017              const parser = new DOMParser();
1018              const htmlDoc = parser.parseFromString(html, "text/html");
1019              const note = htmlDoc.getElementById(id);
1020              if (note !== null) {
1021                const html = processXRef(id, note);
1022                instance.setContent(html);
1023              } 
1024            }).finally(() => {
1025              instance.enable();
1026              instance.show();
1027            });
1028          }
1029        } else {
1030          // See if we can fetch a full url (with no hash to target)
1031          // This is a special case and we should probably do some content thinning / targeting
1032          fetch(url)
1033          .then(res => res.text())
1034          .then(html => {
1035            const parser = new DOMParser();
1036            const htmlDoc = parser.parseFromString(html, "text/html");
1037            const note = htmlDoc.querySelector('main.content');
1038            if (note !== null) {
1039              // This should only happen for chapter cross references
1040              // (since there is no id in the URL)
1041              // remove the first header
1042              if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
1043                note.children[0].remove();
1044              }
1045              const html = processXRef(null, note);
1046              instance.setContent(html);
1047            } 
1048          }).finally(() => {
1049            instance.enable();
1050            instance.show();
1051          });
1052        }
1053      }, function(instance) {
1054      });
1055    }
1056        let selectedAnnoteEl;
1057        const selectorForAnnotation = ( cell, annotation) => {
1058          let cellAttr = 'data-code-cell="' + cell + '"';
1059          let lineAttr = 'data-code-annotation="' +  annotation + '"';
1060          const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
1061          return selector;
1062        }
1063        const selectCodeLines = (annoteEl) => {
1064          const doc = window.document;
1065          const targetCell = annoteEl.getAttribute("data-target-cell");
1066          const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
1067          const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
1068          const lines = annoteSpan.getAttribute("data-code-lines").split(",");
1069          const lineIds = lines.map((line) => {
1070            return targetCell + "-" + line;
1071          })
1072          let top = null;
1073          let height = null;
1074          let parent = null;
1075          if (lineIds.length > 0) {
1076              //compute the position of the single el (top and bottom and make a div)
1077              const el = window.document.getElementById(lineIds[0]);
1078              top = el.offsetTop;
1079              height = el.offsetHeight;
1080              parent = el.parentElement.parentElement;
1081            if (lineIds.length > 1) {
1082              const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
1083              const bottom = lastEl.offsetTop + lastEl.offsetHeight;
1084              height = bottom - top;
1085            }
1086            if (top !== null && height !== null && parent !== null) {
1087              // cook up a div (if necessary) and position it 
1088              let div = window.document.getElementById("code-annotation-line-highlight");
1089              if (div === null) {
1090                div = window.document.createElement("div");
1091                div.setAttribute("id", "code-annotation-line-highlight");
1092                div.style.position = 'absolute';
1093                parent.appendChild(div);
1094              }
1095              div.style.top = top - 2 + "px";
1096              div.style.height = height + 4 + "px";
1097              div.style.left = 0;
1098              let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
1099              if (gutterDiv === null) {
1100                gutterDiv = window.document.createElement("div");
1101                gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
1102                gutterDiv.style.position = 'absolute';
1103                const codeCell = window.document.getElementById(targetCell);
1104                const gutter = codeCell.querySelector('.code-annotation-gutter');
1105                gutter.appendChild(gutterDiv);
1106              }
1107              gutterDiv.style.top = top - 2 + "px";
1108              gutterDiv.style.height = height + 4 + "px";
1109            }
1110            selectedAnnoteEl = annoteEl;
1111          }
1112        };
1113        const unselectCodeLines = () => {
1114          const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
1115          elementsIds.forEach((elId) => {
1116            const div = window.document.getElementById(elId);
1117            if (div) {
1118              div.remove();
1119            }
1120          });
1121          selectedAnnoteEl = undefined;
1122        };
1123          // Handle positioning of the toggle
1124      window.addEventListener(
1125        "resize",
1126        throttle(() => {
1127          elRect = undefined;
1128          if (selectedAnnoteEl) {
1129            selectCodeLines(selectedAnnoteEl);
1130          }
1131        }, 10)
1132      );
1133      function throttle(fn, ms) {
1134      let throttle = false;
1135      let timer;
1136        return (...args) => {
1137          if(!throttle) { // first call gets through
1138              fn.apply(this, args);
1139              throttle = true;
1140          } else { // all the others get throttled
1141              if(timer) clearTimeout(timer); // cancel #2
1142              timer = setTimeout(() => {
1143                fn.apply(this, args);
1144                timer = throttle = false;
1145              }, ms);
1146          }
1147        };
1148      }
1149        // Attach click handler to the DT
1150        const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
1151        for (const annoteDlNode of annoteDls) {
1152          annoteDlNode.addEventListener('click', (event) => {
1153            const clickedEl = event.target;
1154            if (clickedEl !== selectedAnnoteEl) {
1155              unselectCodeLines();
1156              const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
1157              if (activeEl) {
1158                activeEl.classList.remove('code-annotation-active');
1159              }
1160              selectCodeLines(clickedEl);
1161              clickedEl.classList.add('code-annotation-active');
1162            } else {
1163              // Unselect the line
1164              unselectCodeLines();
1165              clickedEl.classList.remove('code-annotation-active');
1166            }
1167          });
1168        }
1169    const findCites = (el) => {
1170      const parentEl = el.parentElement;
1171      if (parentEl) {
1172        const cites = parentEl.dataset.cites;
1173        if (cites) {
1174          return {
1175            el,
1176            cites: cites.split(' ')
1177          };
1178        } else {
1179          return findCites(el.parentElement)
1180        }
1181      } else {
1182        return undefined;
1183      }
1184    };
1185    var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
1186    for (var i=0; i<bibliorefs.length; i++) {
1187      const ref = bibliorefs[i];
1188      const citeInfo = findCites(ref);
1189      if (citeInfo) {
1190        tippyHover(citeInfo.el, function() {
1191          var popup = window.document.createElement('div');
1192          citeInfo.cites.forEach(function(cite) {
1193            var citeDiv = window.document.createElement('div');
1194            citeDiv.classList.add('hanging-indent');
1195            citeDiv.classList.add('csl-entry');
1196            var biblioDiv = window.document.getElementById('ref-' + cite);
1197            if (biblioDiv) {
1198              citeDiv.innerHTML = biblioDiv.innerHTML;
1199            }
1200            popup.appendChild(citeDiv);
1201          });
1202          return popup.innerHTML;
1203        });
1204      }
1205    }
1206  });
1207  </script>
1207
1208</div> <!-- /content -->
1209<footer class="footer">
1210  <div class="nav-footer">
1211    <div class="nav-footer-left">
1212<p><a href="https://hardin47.netlify.app/research/"><i class="fa-solid fa-book" aria-label="book"></i></a> <a href="https://hardin47.netlify.app/resume.pdf" target="_blank"><i class="fa-solid fa-bookmark"></i></a> <a href="mailto:[email protected]" target="_blank"><i class="fa-solid fa-at"></i></a> <a href="https://scholar.google.com/citations?user=c5Y77poAAAAJ&amp;hl=en" target="_blank"><i class="fa-brands fa-google-scholar"></i></a> <a href="https://www.researchgate.net/scientific-contributions/Johanna-Hardin-9764530" target="_blank"><i class="fa-brands fa-researchgate"></i></a><br>
1213<a href="https://github.com/hardin47" target="_blank"><i class="fa-brands fa-github"></i></a> <a href="https://www.linkedin.com/in/jo-hardin-b91a4b55" target="_blank"><i class="fa-brands fa-linkedin-in"></i></a></p>
1214</div>   
1215    <div class="nav-footer-center">
1216      <ul class="footer-items list-unstyled">
1217    <li class="nav-item">
1218 <br> © Jo Hardin, 2026 -- <a href="mailto: [email protected]">[email protected]</a> -- <a href="https://hardin47.netlify.app/">https://hardin47.netlify.app/</a> <br> <br>
1219DS002R -- Foundations of Data Science in R -- Pomona College <br>
1220  </li>  
1221</ul>
1222    </div>
1223    <div class="nav-footer-right">
1224      &nbsp;
1225    </div>
1226  </div>
1227</footer>
1228
1229
1230
1231
1232</body></html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.