Skip to content

Commit f3a7927

Browse files
committed
launch
1 parent 9685005 commit f3a7927

11 files changed

Lines changed: 23 additions & 19 deletions

File tree

2.2 KB
Loading
923 Bytes
Loading
51 Bytes
Loading
9 Bytes
Loading
-1.08 KB
Loading

docs/content/lecture_files/lec5_tidydata/bakeoff_solution.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
88

9-
<meta name="dcterms.date" content="2025-11-21">
9+
<meta name="dcterms.date" content="2025-11-23">
1010

1111
<title>Bakeoff Example – STAT545</title>
1212
<style>
@@ -326,7 +326,7 @@ <h1 class="title">Bakeoff Example</h1>
326326
<div>
327327
<div class="quarto-title-meta-heading">Published</div>
328328
<div class="quarto-title-meta-contents">
329-
<p class="date">November 21, 2025</p>
329+
<p class="date">November 23, 2025</p>
330330
</div>
331331
</div>
332332

docs/index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ <h1 class="title">STAT545 A/B: Exploratory Data Analysis (Fall 2025)</h1>
294294
<div>
295295
<div class="quarto-title-meta-heading">Modified</div>
296296
<div class="quarto-title-meta-contents">
297-
<p class="date-modified">November 16, 2025</p>
297+
<p class="date-modified">November 23, 2025</p>
298298
</div>
299299
</div>
300300

@@ -325,18 +325,20 @@ <h1 class="title">STAT545 A/B: Exploratory Data Analysis (Fall 2025)</h1>
325325
<div class="callout-body-container callout-body">
326326
<p><strong>Lectures:</strong></p>
327327
<ul>
328-
<li>Tuesday November 18: Character Data Lecture</li>
329-
<li>Thursday November 20: Working Session w TAs</li>
328+
<li>Tuesday November 25: Lists, List Columns, and <code>purrr</code></li>
329+
<li>Thursday November 27: Working Session w TAs</li>
330330
</ul>
331331
<p><strong>To Do this Week:</strong></p>
332332
<ul>
333-
<li>Submit on Assignment B2</li>
334-
<li>Start Worksheet B2</li>
333+
<li>Submit on Worksheet B2</li>
334+
<li>Start Worksheet B3</li>
335+
<li>Continue working on Assignment B3</li>
335336
</ul>
336337
<p><strong>Upcoming Deadlines</strong></p>
337338
<ul>
338-
<li>Assignment B2: November 19th, 11:59pm PST</li>
339339
<li>Worksheet B2: November 25, 11:59pm PST</li>
340+
<li>Worksheet B3: December 5th, 11:59pm PST (EXTENDED)</li>
341+
<li>Assignment B3: December 5th, 11:59pm PST</li>
340342
</ul>
341343
</div>
342344
</div>

docs/search.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"href": "webpages/lectures_ii/lec8b_advfunctions.html#default-parameters",
195195
"title": "Lecture 8b: Advanced Functions",
196196
"section": "Default Parameters",
197-
"text": "Default Parameters\nRecall the dice-rolling example from the previous lecture. Sometimes you want to use a function frequently without re-writing the same parameters over and over again. Let’s make a more flexible function that allows us to change the number of faces on the dice being rolled.\n\n#' @details\n#' Simulates rolling `num_dice` number of dice with `n_sides` sides and outputs the sum. Note: no seed is used so the function will return a dice combination each time it is run\n#'\n#' @param num_dice integer representing number of dice to be rolled\n#' @param n_sides integer representing the number of sides of each dice\n#' @return the sum of the dice rolled\n \nroll_dice &lt;- function(n_sides, num_dice) { \n \n # throw an error if num_dice (the input) is not an integer\n \n if(num_dice %% 1 != 0){ #if num_dice mod 1 is NOT 0\n stop(\"num_dice must be an integer\") #throw this error message and stop the function\n }\n \n #if the num_dice is an integer, continue with the function:\n sum(sample(1:n_sides, num_dice, replace=TRUE)) #sample two numbers from one to n_sides with replacement, return sum\n}\n\nNotice now that in this function, there are two parameters (the new one is n_sides). We now sample from 1:nsides (instead of 1:10) to make the function more flexible. I also renamed the function to roll_dice as we are not necessarily rolling 10 sided dice.\nSo to roll two 10-sided dice, I can call:\n\nroll_dice(n_sides = 10, num_dice = 2)\n\n[1] 9\n\n\nNow, perhaps I often want to roll ten-sided dice. To avoid having to type n_sides = 10, I can simply make the default number of sides to 10!\n\n#' @details\n#' Simulates rolling `num_dice` number of dice with `n_sides` sides and outputs the sum. Note: no seed is used so the function will return a dice combination each time it is run\n#'\n#' @param num_dice integer representing number of dice to be rolled\n#' @param n_sides integer representing the number of sides of each dice. Default is 10.\n#' @return the sum of the dice rolled\n \nroll_dice &lt;- function(n_sides = 10, num_dice) { #NEW: n_sides default is 10\n \n # throw an error if num_dice (the input) is not an integer\n \n if(num_dice %% 1 != 0){ #if num_dice mod 1 is NOT 0\n stop(\"num_dice must be an integer\") #throw this error message and stop the function\n }\n \n #if the num_dice is an integer, continue with the function:\n sum(sample(1:n_sides, num_dice, replace=TRUE)) #sample two numbers from one to n_sides with replacement, return sum\n}\n\nWe have set n_sides = 10 as the default. This means the function will assume we have a 10 sided dice unless otherwise specified. Let’s roll 3 dice using 10 sided dice (the default):\n\nroll_dice(num_dice = 3)\n\n[1] 21\n\n\nI didn’t need to include n_sides = 10 in my function call! But I can if I want to change it to a number other than 10. Let’s roll 3 standard 6-sided dice\n\nroll_dice(n_sides = 6, num_dice = 3)\n\n[1] 9\n\n\n\n\n\n\n\n\nExercise: Default Values\n\n\n\nMake a new argument for the summarizeby_fun() we made previously called columns that allows you to input a vector containing which columns you wish to look at missing values for (these can be written as strings). Set the default to everything().\n\n\n\n\n\n\n\n\nClick to reveal the solution!\n\n\n\n\n\n\nsummarizeby_fun &lt;- function(data, groups, columns = everything()){\n data %&gt;%\n group_by({{groups}}) %&gt;%\n summarize(across(columns, ~ sum(is.na(.x))))\n}\n\nsummarizeby_fun(penguins, species)\n\nWarning: There was 1 warning in `summarize()`.\nℹ In argument: `across(columns, ~sum(is.na(.x)))`.\nCaused by warning:\n! Using an external vector in selections was deprecated in tidyselect 1.1.0.\nℹ Please use `all_of()` or `any_of()` instead.\n # Was:\n data %&gt;% select(columns)\n\n # Now:\n data %&gt;% select(all_of(columns))\n\nSee &lt;https://tidyselect.r-lib.org/reference/faq-external-vector.html&gt;.\n\n\n# A tibble: 3 × 8\n species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g\n &lt;fct&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt;\n1 Adelie 0 1 1 1 1\n2 Chinstrap 0 0 0 0 0\n3 Gentoo 0 1 1 1 1\n# ℹ 2 more variables: sex &lt;int&gt;, year &lt;int&gt;\n\nsummarizeby_fun(penguins, species, c(\"bill_length_mm\", \"sex\"))\n\n# A tibble: 3 × 3\n species bill_length_mm sex\n &lt;fct&gt; &lt;int&gt; &lt;int&gt;\n1 Adelie 1 6\n2 Chinstrap 0 0\n3 Gentoo 1 5",
197+
"text": "Default Parameters\nRecall the dice-rolling example from the previous lecture. Sometimes you want to use a function frequently without re-writing the same parameters over and over again. Let’s make a more flexible function that allows us to change the number of faces on the dice being rolled.\n\n#' @details\n#' Simulates rolling `num_dice` number of dice with `n_sides` sides and outputs the sum. Note: no seed is used so the function will return a dice combination each time it is run\n#'\n#' @param num_dice integer representing number of dice to be rolled\n#' @param n_sides integer representing the number of sides of each dice\n#' @return the sum of the dice rolled\n \nroll_dice &lt;- function(n_sides, num_dice) { \n \n # throw an error if num_dice (the input) is not an integer\n \n if(num_dice %% 1 != 0){ #if num_dice mod 1 is NOT 0\n stop(\"num_dice must be an integer\") #throw this error message and stop the function\n }\n \n #if the num_dice is an integer, continue with the function:\n sum(sample(1:n_sides, num_dice, replace=TRUE)) #sample two numbers from one to n_sides with replacement, return sum\n}\n\nNotice now that in this function, there are two parameters (the new one is n_sides). We now sample from 1:nsides (instead of 1:10) to make the function more flexible. I also renamed the function to roll_dice as we are not necessarily rolling 10 sided dice.\nSo to roll two 10-sided dice, I can call:\n\nroll_dice(n_sides = 10, num_dice = 2)\n\n[1] 14\n\n\nNow, perhaps I often want to roll ten-sided dice. To avoid having to type n_sides = 10, I can simply make the default number of sides to 10!\n\n#' @details\n#' Simulates rolling `num_dice` number of dice with `n_sides` sides and outputs the sum. Note: no seed is used so the function will return a dice combination each time it is run\n#'\n#' @param num_dice integer representing number of dice to be rolled\n#' @param n_sides integer representing the number of sides of each dice. Default is 10.\n#' @return the sum of the dice rolled\n \nroll_dice &lt;- function(n_sides = 10, num_dice) { #NEW: n_sides default is 10\n \n # throw an error if num_dice (the input) is not an integer\n \n if(num_dice %% 1 != 0){ #if num_dice mod 1 is NOT 0\n stop(\"num_dice must be an integer\") #throw this error message and stop the function\n }\n \n #if the num_dice is an integer, continue with the function:\n sum(sample(1:n_sides, num_dice, replace=TRUE)) #sample two numbers from one to n_sides with replacement, return sum\n}\n\nWe have set n_sides = 10 as the default. This means the function will assume we have a 10 sided dice unless otherwise specified. Let’s roll 3 dice using 10 sided dice (the default):\n\nroll_dice(num_dice = 3)\n\n[1] 11\n\n\nI didn’t need to include n_sides = 10 in my function call! But I can if I want to change it to a number other than 10. Let’s roll 3 standard 6-sided dice\n\nroll_dice(n_sides = 6, num_dice = 3)\n\n[1] 14\n\n\n\n\n\n\n\n\nExercise: Default Values\n\n\n\nMake a new argument for the summarizeby_fun() we made previously called columns that allows you to input a vector containing which columns you wish to look at missing values for (these can be written as strings). Set the default to everything().\n\n\n\n\n\n\n\n\nClick to reveal the solution!\n\n\n\n\n\n\nsummarizeby_fun &lt;- function(data, groups, columns = everything()){\n data %&gt;%\n group_by({{groups}}) %&gt;%\n summarize(across(columns, ~ sum(is.na(.x))))\n}\n\nsummarizeby_fun(penguins, species)\n\nWarning: There was 1 warning in `summarize()`.\nℹ In argument: `across(columns, ~sum(is.na(.x)))`.\nCaused by warning:\n! Using an external vector in selections was deprecated in tidyselect 1.1.0.\nℹ Please use `all_of()` or `any_of()` instead.\n # Was:\n data %&gt;% select(columns)\n\n # Now:\n data %&gt;% select(all_of(columns))\n\nSee &lt;https://tidyselect.r-lib.org/reference/faq-external-vector.html&gt;.\n\n\n# A tibble: 3 × 8\n species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g\n &lt;fct&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt; &lt;int&gt;\n1 Adelie 0 1 1 1 1\n2 Chinstrap 0 0 0 0 0\n3 Gentoo 0 1 1 1 1\n# ℹ 2 more variables: sex &lt;int&gt;, year &lt;int&gt;\n\nsummarizeby_fun(penguins, species, c(\"bill_length_mm\", \"sex\"))\n\n# A tibble: 3 × 3\n species bill_length_mm sex\n &lt;fct&gt; &lt;int&gt; &lt;int&gt;\n1 Adelie 1 6\n2 Chinstrap 0 0\n3 Gentoo 1 5",
198198
"crumbs": [
199199
"Lecture 8b: Advanced Functions"
200200
]
@@ -1758,7 +1758,7 @@
17581758
"href": "index.html",
17591759
"title": "STAT545 A/B: Exploratory Data Analysis (Fall 2025)",
17601760
"section": "",
1761-
"text": "This Week at a Glance\n\n\n\nLectures:\n\nTuesday November 18: Character Data Lecture\nThursday November 20: Working Session w TAs\n\nTo Do this Week:\n\nSubmit on Assignment B2\nStart Worksheet B2\n\nUpcoming Deadlines\n\nAssignment B2: November 19th, 11:59pm PST\nWorksheet B2: November 25, 11:59pm PST"
1761+
"text": "This Week at a Glance\n\n\n\nLectures:\n\nTuesday November 25: Lists, List Columns, and purrr\nThursday November 27: Working Session w TAs\n\nTo Do this Week:\n\nSubmit on Worksheet B2\nStart Worksheet B3\nContinue working on Assignment B3\n\nUpcoming Deadlines\n\nWorksheet B2: November 25, 11:59pm PST\nWorksheet B3: December 5th, 11:59pm PST (EXTENDED)\nAssignment B3: December 5th, 11:59pm PST"
17621762
},
17631763
{
17641764
"objectID": "index.html#welcome",

docs/webpages/lectures_ii/lec8b_advfunctions.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ <h2 class="anchored" data-anchor-id="default-parameters">Default Parameters</h2>
592592
<div class="cell">
593593
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">roll_dice</span>(<span class="at">n_sides =</span> <span class="dv">10</span>, <span class="at">num_dice =</span> <span class="dv">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
594594
<div class="cell-output cell-output-stdout">
595-
<pre><code>[1] 9</code></pre>
595+
<pre><code>[1] 14</code></pre>
596596
</div>
597597
</div>
598598
<p>Now, perhaps I often want to roll ten-sided dice. To avoid having to type <code>n_sides = 10</code>, I can simply make the default number of sides to 10!</p>
@@ -620,14 +620,14 @@ <h2 class="anchored" data-anchor-id="default-parameters">Default Parameters</h2>
620620
<div class="cell">
621621
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">roll_dice</span>(<span class="at">num_dice =</span> <span class="dv">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
622622
<div class="cell-output cell-output-stdout">
623-
<pre><code>[1] 21</code></pre>
623+
<pre><code>[1] 11</code></pre>
624624
</div>
625625
</div>
626626
<p>I didn’t need to include <code>n_sides = 10</code> in my function call! But I can if I want to change it to a number other than 10. Let’s roll 3 standard 6-sided dice</p>
627627
<div class="cell">
628628
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">roll_dice</span>(<span class="at">n_sides =</span> <span class="dv">6</span>, <span class="at">num_dice =</span> <span class="dv">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
629629
<div class="cell-output cell-output-stdout">
630-
<pre><code>[1] 9</code></pre>
630+
<pre><code>[1] 14</code></pre>
631631
</div>
632632
</div>
633633
<div class="callout callout-style-simple callout-warning no-icon callout-titled">

index.qmd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ date-modified: last-modified
1717

1818
**Lectures:**
1919

20-
- Tuesday November 18: Character Data Lecture
21-
- Thursday November 20: Working Session w TAs
20+
- Tuesday November 25: Lists, List Columns, and `purrr`
21+
- Thursday November 27: Working Session w TAs
2222

2323
**To Do this Week:**
2424

25-
- Submit on Assignment B2
26-
- Start Worksheet B2
25+
- Submit on Worksheet B2
26+
- Start Worksheet B3
27+
- Continue working on Assignment B3
2728

2829
**Upcoming Deadlines**
2930

30-
- Assignment B2: November 19th, 11:59pm PST
3131
- Worksheet B2: November 25, 11:59pm PST
32+
- Worksheet B3: December 5th, 11:59pm PST (EXTENDED)
33+
- Assignment B3: December 5th, 11:59pm PST
3234
:::
3335
::::
3436
:::::::

0 commit comments

Comments
 (0)