Skip to content

Commit

Permalink
Add theme of questions
Browse files Browse the repository at this point in the history
  • Loading branch information
chipmanj committed Aug 27, 2024
1 parent 4c2b434 commit b9f1101
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
40 changes: 20 additions & 20 deletions 02-essentials/slides.html
Original file line number Diff line number Diff line change
Expand Up @@ -3042,25 +3042,25 @@ <h2 id="toc-title">Table of contents</h2>
<ul class="collapse">
<li><a href="#modes" id="toc-modes" class="nav-link" data-scroll-target="#modes">Modes</a></li>
<li><a href="#structures" id="toc-structures" class="nav-link" data-scroll-target="#structures">Structures</a></li>
<li><a href="#questions-1" id="toc-questions-1" class="nav-link" data-scroll-target="#questions-1">Questions 1</a></li>
<li><a href="#questions-1-structures" id="toc-questions-1-structures" class="nav-link" data-scroll-target="#questions-1-structures">Questions 1: Structures</a></li>
<li><a href="#missing-values" id="toc-missing-values" class="nav-link" data-scroll-target="#missing-values">Missing values</a></li>
<li><a href="#vectors-and-matrixes" id="toc-vectors-and-matrixes" class="nav-link" data-scroll-target="#vectors-and-matrixes">Vectors and matrixes</a></li>
<li><a href="#questions-2" id="toc-questions-2" class="nav-link" data-scroll-target="#questions-2">Questions 2</a></li>
<li><a href="#questions-2-naming-objects" id="toc-questions-2-naming-objects" class="nav-link" data-scroll-target="#questions-2-naming-objects">Questions 2: Naming objects</a></li>
<li><a href="#lists" id="toc-lists" class="nav-link" data-scroll-target="#lists">Lists</a></li>
<li><a href="#data.frames" id="toc-data.frames" class="nav-link" data-scroll-target="#data.frames">data.frames</a></li>
</ul></li>
<li><a href="#naming-indexing-and-filtering" id="toc-naming-indexing-and-filtering" class="nav-link" data-scroll-target="#naming-indexing-and-filtering">Naming, indexing, and filtering</a></li>
<li><a href="#filtering-vectors" id="toc-filtering-vectors" class="nav-link" data-scroll-target="#filtering-vectors">Filtering vectors</a>
<ul class="collapse">
<li><a href="#questions-3" id="toc-questions-3" class="nav-link" data-scroll-target="#questions-3">Questions 3</a></li>
<li><a href="#questions-3-filtering-objects" id="toc-questions-3-filtering-objects" class="nav-link" data-scroll-target="#questions-3-filtering-objects">Questions 3: Filtering objects</a></li>
</ul></li>
<li><a href="#ifthen-statements-loops-and-functions-control-statements" id="toc-ifthen-statements-loops-and-functions-control-statements" class="nav-link" data-scroll-target="#ifthen-statements-loops-and-functions-control-statements">If/Then Statements, Loops, and Functions (Control Statements)</a>
<ul class="collapse">
<li><a href="#if-then-statements" id="toc-if-then-statements" class="nav-link" data-scroll-target="#if-then-statements">If-then statements</a></li>
<li><a href="#loops" id="toc-loops" class="nav-link" data-scroll-target="#loops">Loops</a></li>
<li><a href="#questions-4" id="toc-questions-4" class="nav-link" data-scroll-target="#questions-4">Questions 4</a></li>
<li><a href="#questions-4-creating-a-loop" id="toc-questions-4-creating-a-loop" class="nav-link" data-scroll-target="#questions-4-creating-a-loop">Questions 4: Creating a loop</a></li>
<li><a href="#functions" id="toc-functions" class="nav-link" data-scroll-target="#functions">Functions</a></li>
<li><a href="#questions-5" id="toc-questions-5" class="nav-link" data-scroll-target="#questions-5">Questions 5</a></li>
<li><a href="#questions-5-creating-a-function" id="toc-questions-5-creating-a-function" class="nav-link" data-scroll-target="#questions-5-creating-a-function">Questions 5: Creating a function</a></li>
</ul></li>
<li><a href="#vectorizing-and-replicate" id="toc-vectorizing-and-replicate" class="nav-link" data-scroll-target="#vectorizing-and-replicate">Vectorizing and replicate</a></li>
<li><a href="#session-info" id="toc-session-info" class="nav-link" data-scroll-target="#session-info">Session info</a></li>
Expand Down Expand Up @@ -3486,8 +3486,8 @@ <h2 class="anchored" data-anchor-id="structures">Structures</h2>
</tbody>
</table>
</section>
<section id="questions-1" class="level2">
<h2 class="anchored" data-anchor-id="questions-1">Questions 1</h2>
<section id="questions-1-structures" class="level2">
<h2 class="anchored" data-anchor-id="questions-1-structures">Questions 1: Structures</h2>
<ol type="1">
<li><p>What structure would you want to perform a computationally-heavy task?</p></li>
<li><p>What structure would you want to read in data from a colleague?</p></li>
Expand Down Expand Up @@ -3744,8 +3744,8 @@ <h3 class="anchored" data-anchor-id="naming-and-indexing-vectors-and-matrices">N
<p>In the last example, why is the dimension <code>NULL</code>? (Hint, what is the class of the last two examples?)</p>
</section>
</section>
<section id="questions-2" class="level2">
<h2 class="anchored" data-anchor-id="questions-2">Questions 2</h2>
<section id="questions-2-naming-objects" class="level2">
<h2 class="anchored" data-anchor-id="questions-2-naming-objects">Questions 2: Naming objects</h2>
<ol type="1">
<li><p>What is the number of the alphabet for each letter of your name? Use a vector with names (try the `LETTERS’ object). For example, if the letters to the name JONATHAN were mapped to integers, the result would be: 10, 15, 14, 1, 20, 8, 1, 14.</p></li>
<li><p>Why is it important extract elements through naming conventions?</p></li>
Expand Down Expand Up @@ -3997,8 +3997,8 @@ <h1>Filtering vectors</h1>
<pre><code>[1] FALSE</code></pre>
</div>
</div>
<section id="questions-3" class="level2">
<h2 class="anchored" data-anchor-id="questions-3">Questions 3</h2>
<section id="questions-3-filtering-objects" class="level2">
<h2 class="anchored" data-anchor-id="questions-3-filtering-objects">Questions 3: Filtering objects</h2>
<p>Suppose <code>x</code> is the number of vacations in the years 2010 - 2019</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb103"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb103-1"><a href="#cb103-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">1</span>)</span>
Expand Down Expand Up @@ -4138,8 +4138,8 @@ <h2 class="anchored" data-anchor-id="loops">Loops</h2>
</div>
<p>The <code>next</code> statement allows the loop to stop current iteration and continue to next iteration.</p>
</section>
<section id="questions-4" class="level2">
<h2 class="anchored" data-anchor-id="questions-4">Questions 4</h2>
<section id="questions-4-creating-a-loop" class="level2">
<h2 class="anchored" data-anchor-id="questions-4-creating-a-loop">Questions 4: Creating a loop</h2>
<p>From Jan 1 - Jan 9, 2023, it snowed 6 days atop Snowbasin. Snow days can be represented each day in a vector as 1 (snow) and 0 (no snow).</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb109"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb109-1"><a href="#cb109-1" aria-hidden="true" tabindex="-1"></a>snow <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">0</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">0</span>,<span class="dv">0</span>)</span>
Expand Down Expand Up @@ -4205,8 +4205,8 @@ <h2 class="anchored" data-anchor-id="functions">Functions</h2>
</div></li>
</ul>
</section>
<section id="questions-5" class="level2">
<h2 class="anchored" data-anchor-id="questions-5">Questions 5</h2>
<section id="questions-5-creating-a-function" class="level2">
<h2 class="anchored" data-anchor-id="questions-5-creating-a-function">Questions 5: Creating a function</h2>
<p>Generalize your code to Question 4 as a function so that for any string of days you can find the first day it consecutively snowed a given number of days. Return <code>NA</code> if no day meets this criteria.</p>
</section>
</section>
Expand Down Expand Up @@ -5171,7 +5171,7 @@ <h1>Session info</h1>
<span id="cb127-296"><a href="#cb127-296" aria-hidden="true" tabindex="-1"></a>| **Usage** | Simple collections like numerical data | Mathematical computations, matrices | Grouping mixed-type data, complex structures | Tabular data, similar to Excel spreadsheets |</span>
<span id="cb127-297"><a href="#cb127-297" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-298"><a href="#cb127-298" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-299"><a href="#cb127-299" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 1</span></span>
<span id="cb127-299"><a href="#cb127-299" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 1: Structures</span></span>
<span id="cb127-300"><a href="#cb127-300" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-301"><a href="#cb127-301" aria-hidden="true" tabindex="-1"></a><span class="ss">1. </span>What structure would you want to perform a computationally-heavy task?</span>
<span id="cb127-302"><a href="#cb127-302" aria-hidden="true" tabindex="-1"></a></span>
Expand Down Expand Up @@ -5336,7 +5336,7 @@ <h1>Session info</h1>
<span id="cb127-475"><a href="#cb127-475" aria-hidden="true" tabindex="-1"></a>In the last example, why is the dimension <span class="in">`NULL`</span>? (Hint, what is the class of the last two examples?)</span>
<span id="cb127-476"><a href="#cb127-476" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-477"><a href="#cb127-477" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-478"><a href="#cb127-478" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 2</span></span>
<span id="cb127-478"><a href="#cb127-478" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 2: Naming objects</span></span>
<span id="cb127-479"><a href="#cb127-479" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-480"><a href="#cb127-480" aria-hidden="true" tabindex="-1"></a><span class="ss">1. </span>What is the number of the alphabet for each letter of your name? Use a vector with names (try the `LETTERS&#39; object). For example, if the letters to the name JONATHAN were mapped to integers, the result would be: 10, 15, 14, 1, 20, 8, 1, 14.</span>
<span id="cb127-481"><a href="#cb127-481" aria-hidden="true" tabindex="-1"></a></span>
Expand Down Expand Up @@ -5478,7 +5478,7 @@ <h1>Session info</h1>
<span id="cb127-631"><a href="#cb127-631" aria-hidden="true" tabindex="-1"></a><span class="in">```</span></span>
<span id="cb127-632"><a href="#cb127-632" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-633"><a href="#cb127-633" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-634"><a href="#cb127-634" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 3</span></span>
<span id="cb127-634"><a href="#cb127-634" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 3: Filtering objects</span></span>
<span id="cb127-635"><a href="#cb127-635" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-636"><a href="#cb127-636" aria-hidden="true" tabindex="-1"></a>Suppose <span class="in">`x`</span> is the number of vacations in the years 2010 - 2019</span>
<span id="cb127-637"><a href="#cb127-637" aria-hidden="true" tabindex="-1"></a><span class="in">```{r, collapse=TRUE, comment=&quot;&gt;&quot;}</span></span>
Expand Down Expand Up @@ -5638,7 +5638,7 @@ <h1>Session info</h1>
<span id="cb127-791"><a href="#cb127-791" aria-hidden="true" tabindex="-1"></a>The <span class="in">`next`</span> statement allows the loop to stop current iteration and continue to next iteration.</span>
<span id="cb127-792"><a href="#cb127-792" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-793"><a href="#cb127-793" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-794"><a href="#cb127-794" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 4</span></span>
<span id="cb127-794"><a href="#cb127-794" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 4: Creating a loop</span></span>
<span id="cb127-795"><a href="#cb127-795" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-796"><a href="#cb127-796" aria-hidden="true" tabindex="-1"></a>From Jan 1 - Jan 9, 2023, it snowed 6 days atop Snowbasin. Snow days can be represented each day in a vector as 1 (snow) and 0 (no snow).</span>
<span id="cb127-797"><a href="#cb127-797" aria-hidden="true" tabindex="-1"></a></span>
Expand Down Expand Up @@ -5727,7 +5727,7 @@ <h1>Session info</h1>
<span id="cb127-882"><a href="#cb127-882" aria-hidden="true" tabindex="-1"></a> <span class="fu">prop.table</span>(<span class="fu">table</span>(tosses))</span>
<span id="cb127-883"><a href="#cb127-883" aria-hidden="true" tabindex="-1"></a> <span class="in">```</span></span>
<span id="cb127-884"><a href="#cb127-884" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-885"><a href="#cb127-885" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 5</span></span>
<span id="cb127-885"><a href="#cb127-885" aria-hidden="true" tabindex="-1"></a><span class="fu">## Questions 5: Creating a function</span></span>
<span id="cb127-886"><a href="#cb127-886" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb127-887"><a href="#cb127-887" aria-hidden="true" tabindex="-1"></a>Generalize your code to Question 4 as a function so that for any string of days you can find the first day it consecutively snowed a given number of days. Return <span class="in">`NA`</span> if no day meets this criteria.</span>
<span id="cb127-888"><a href="#cb127-888" aria-hidden="true" tabindex="-1"></a></span>
Expand Down
10 changes: 5 additions & 5 deletions 02-essentials/slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Data are stored in any of the following structures (starting from most primitive
| **Usage** | Simple collections like numerical data | Mathematical computations, matrices | Grouping mixed-type data, complex structures | Tabular data, similar to Excel spreadsheets |


## Questions 1
## Questions 1: Structures

1. What structure would you want to perform a computationally-heavy task?

Expand Down Expand Up @@ -459,7 +459,7 @@ dim(x["2010",c("SLC","Milcreek")])
In the last example, why is the dimension `NULL`? (Hint, what is the class of the last two examples?)


## Questions 2
## Questions 2: Naming objects

1. What is the number of the alphabet for each letter of your name? Use a vector with names (try the `LETTERS' object). For example, if the letters to the name JONATHAN were mapped to integers, the result would be: 10, 15, 14, 1, 20, 8, 1, 14.

Expand Down Expand Up @@ -601,7 +601,7 @@ all(tx==1)
```


## Questions 3
## Questions 3: Filtering objects

Suppose `x` is the number of vacations in the years 2010 - 2019
```{r, collapse=TRUE, comment=">"}
Expand Down Expand Up @@ -761,7 +761,7 @@ i
The `next` statement allows the loop to stop current iteration and continue to next iteration.


## Questions 4
## Questions 4: Creating a loop

From Jan 1 - Jan 9, 2023, it snowed 6 days atop Snowbasin. Snow days can be represented each day in a vector as 1 (snow) and 0 (no snow).

Expand Down Expand Up @@ -850,7 +850,7 @@ runs
prop.table(table(tosses))
```

## Questions 5
## Questions 5: Creating a function

Generalize your code to Question 4 as a function so that for any string of days you can find the first day it consecutively snowed a given number of days. Return `NA` if no day meets this criteria.

Expand Down

0 comments on commit b9f1101

Please sign in to comment.