Skip to content

Commit

Permalink
Merge branch 'main' into datasets-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
avahoffman committed Sep 30, 2024
2 parents bc38e5e + 9a267eb commit 40bba7e
Show file tree
Hide file tree
Showing 20 changed files with 1,111 additions and 7,451 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ default:
* **Fall Session ** : September 30 - October 10 (online/virtual course) + October 23-25 (in person in Seattle)
course_time: "1:30 p.m. - 4:50 p.m. ET"
register_link: "https://forms.gle/BNrdKJJ8PHpQtKMS8"
codeathon_schedule: "https://docs.google.com/document/d/182XiteW4-VOWLesVBU6TH1hhyDH7dHkGAXf6P8WYyjg/edit?usp=sharing"
codeathon_schedule: "https://docs.google.com/document/d/1ZD-w0vc3Vtv1vf95h6323zaaxORg9vC7Hp4I_IUeW0I/edit?usp=sharing"
instructor_slides: "https://drive.google.com/drive/folders/1dd0refHBdOHQuMW2ITWsVtIZ1QyhEbgY?usp=sharing"
lightning_talk_folder: "https://drive.google.com/drive/folders/1It8HqAyXGY8NpDU6iVxswMeZCth8kHI5?usp=sharing"
#final_due_date: "January 24th at 11:59pm ET"
Expand Down
8 changes: 4 additions & 4 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,14 @@ <h2><strong>Why are my changes not taking effect? It’s making my results look
<p>Here we are creating a new object from an existing one:</p>
<pre class="r"><code>new_rivers &lt;- sample(rivers, 5)
new_rivers</code></pre>
<pre><code>## [1] 202 215 260 375 300</code></pre>
<pre><code>## [1] 350 306 525 350 380</code></pre>
<p>Using just this will only print the result and not actually change <code>new_rivers</code>:</p>
<pre class="r"><code>new_rivers + 1</code></pre>
<pre><code>## [1] 203 216 261 376 301</code></pre>
<pre><code>## [1] 351 307 526 351 381</code></pre>
<p>If we want to modify <code>new_rivers</code> and save that modified version, then we need to reassign <code>new_rivers</code> like so:</p>
<pre class="r"><code>new_rivers &lt;- new_rivers + 1
new_rivers</code></pre>
<pre><code>## [1] 203 216 261 376 301</code></pre>
<pre><code>## [1] 351 307 526 351 381</code></pre>
<p>If we forget to reassign this can cause subsequent steps to not work as expected because we will not be working with the data that has been modified.</p>
<hr />
</div>
Expand Down Expand Up @@ -406,7 +406,7 @@ <h2><strong>Error: object ‘X’ not found</strong></h2>
<p>Make sure you run something like this, with the <code>&lt;-</code> operator:</p>
<pre class="r"><code>rivers2 &lt;- new_rivers + 1
rivers2</code></pre>
<pre><code>## [1] 204 217 262 377 302</code></pre>
<pre><code>## [1] 352 308 527 352 382</code></pre>
<hr />
</div>
<div id="error-unexpected-in-error-unexpected-in-error-unexpected-x-in" class="section level2">
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ <h2>Testimonials from our other courses:</h2>
<h2>Find an Error!?</h2>
<hr />
<p>Feel free to submit typos/errors/etc via the GitHub repository associated with the class: <a href="https://github.com/fhdsl/DaSEH" class="uri">https://github.com/fhdsl/DaSEH</a></p>
<p>This page was last updated on 2024-09-27.</p>
<p>This page was last updated on 2024-09-30.</p>
<p style="text-align:center;">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://live.staticflickr.com/4557/26350808799_6f9c8bcaa2_b.jpg" height="150"/> </a>
</p>
Expand Down
Binary file modified modules/.pdf
Binary file not shown.
432 changes: 93 additions & 339 deletions modules/HW/homework2.html

Large diffs are not rendered by default.

Binary file modified modules/Intro/Intro.pdf
Binary file not shown.
56 changes: 30 additions & 26 deletions modules/RStudio/RStudio.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -316,19 +316,6 @@ You can run all chunks above a specific chunk using this button:
knitr::include_graphics("images/previous_chunks.png")
```

## Chunk settings

```{r echo=FALSE, fig.align='center', out.width="80%"}
knitr::include_graphics("images/chunk_settings.png")
```

## Chunk settings

You can specify if a chunk will be seen in the report or not.

```{r echo=FALSE, fig.align='center', out.width="80%"}
knitr::include_graphics("images/chunk_settings2.png")
```

## Errors

Expand All @@ -339,19 +326,6 @@ Note that sometimes the error occurs earlier than RStudio thinks.
knitr::include_graphics("images/errors.png")
```

## Rainbow Parentheses

Tools --> Global Options --> Code --> Display --> Use rainbow parentheses

Press enter to save this setting and get out of this menu.

<br>
<br>

```{r echo=FALSE, fig.align='center', out.width="80%"}
knitr::include_graphics("https://posit.co/wp-content/themes/Posit/public/markdown-blogs/rstudio-1-4-preview-rainbow-parentheses/colorfulCode.png")
```


## Useful R Studio Shortcuts

Expand Down Expand Up @@ -442,7 +416,37 @@ Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribu

# Extra Slides

## Chunk settings

```{r echo=FALSE, fig.align='center', out.width="80%"}
knitr::include_graphics("images/chunk_settings.png")
```

## Chunk settings

You can specify if a chunk will be seen in the report or not.

```{r echo=FALSE, fig.align='center', out.width="80%"}
knitr::include_graphics("images/chunk_settings2.png")
```

## Sometimes you want to hide your code

If you want to keep your code so people can see it if they want to there is a nice option called code folding - check it out here: https://stackoverflow.com/questions/69326576/show-output-but-hide-code-when-sending-rmd-to-other-people

## Rainbow Parentheses

Tools --> Global Options --> Code --> Display --> Use rainbow parentheses

This can help you see your code more easily.

Press enter to save this setting and get out of this menu.

<br>
<br>

```{r echo=FALSE, fig.align='center', out.width="80%"}
knitr::include_graphics("https://posit.co/wp-content/themes/Posit/public/markdown-blogs/rstudio-1-4-preview-rainbow-parentheses/colorfulCode.png")
```


44 changes: 23 additions & 21 deletions modules/RStudio/RStudio.html

Large diffs are not rendered by default.

Binary file modified modules/RStudio/RStudio.pdf
Binary file not shown.
45 changes: 24 additions & 21 deletions modules/RStudio/lab/RStudio_Lab.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ editor_options:

# R Markdown

Please read through everything and then try the exercises. This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. The way you can create a file like this in RStudio is: File → New File → R Markdown and then using the default or using a template.
The file you are reading is called an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. The way you can create a file like this in RStudio is: File → New File → R Markdown and then using the default or using a template.

1. Try compiling this document using the “Knit” button. What files are produced?

### The Code

The gray area below is a code chunk that will set up our packages and data. You can also run the code within the editor area by pressing the green play button. Don't worry right now about what the code is doing, we will cover this later. We just want you to get used to RStudio and RMarkdowns. This dataset is one we'll be working with quite a lot in the lectures. It contains county-level data about ER visits for heat-related illnesses in Colorado for the years 2011-2022.

2. Press the green play button. What happens (check the environment too!)?

```{r setup, message=FALSE}
library(tidyverse)
Expand All @@ -22,13 +26,17 @@ er_2 <- er %>%
filter(!is.na(rate))
```

When you click the **Knit** button (at the top of RStudio), a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. Next we will show you some code - no worries about understanding it yet, we just want to get you familiar with where code goes. When code is in an RMarkdown file chunk, it is saved to a file. When it is in the console, it is not saved. The console is useful for installing packages like we just did, this is because we only need to do it once, so we don't usually need to save the code.
When you click the **Knit** button (at the top of RStudio), a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. Note that when it does this it starts from scratch - it can't use any objects you created outside of the Rmd file. Therefore it essentially has its own environment that is different from the one that you see when working interactively in RStudio.

### Plotting some data

Here is code that will make a plot of some data.You can embed an R code chunk like this: Try pressing the green play button to see what happens. Make sure you have run the previous code chunk first by pressing the green play button in that chunk.
Here is code that will make a plot of some data.

3. Try the "run all chunks above" button that is to the left of the play button on the following chunk. What happens?

```{r plot, out.width = "100%"}
4. Then press the play button on this same chunk. What happens?

```{r out.width = "100%"}
# keep only some counties
er_3 <- er_2 %>%
filter(county %in% c("Arapahoe", "Denver", "Jefferson", "Larimer"))
Expand All @@ -37,43 +45,38 @@ palette <- c(
Arapahoe = "blue",
Denver = "darkgreen",
Jefferson = "orange",
Larimer = "purple"
Larimer = "salmon"
)
ggplot(aes(x = year, y = rate, colour = county, group = county), data = er_3) +
geom_line() +
scale_colour_manual(values = palette)
```

```{r out.width = "100%", label = '0response'}
```
### Adding new chunks


# Exercise

Here are a few changes that will show you how to change small things in `R` code and the output it makes. After each change, hit the **Knit** button again.

### 1.1

Go through the code for the plot above and change the colors in `palette` to something other than what they originally were. See http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a large list of colors. For example, you could replace blue with red.

### 1.2

Add a new R chunk after `<!-- Your code chunk goes here -->`. You can use the insert chunk button or copy paste an existing code chunk. Include a lowercase x inside the chunk as the code. Make sure you press the knit button after this to see what the new chunk looks like.
5. Add a new R chunk after `<!-- Your code chunk goes here -->`. You can use the insert chunk button or copy paste an existing code chunk. Include a lowercase x inside the chunk as the code. Make sure you press the knit button after this to see what the new chunk looks like.

```{r}
x <- c(1, 2, 3)
```

<!-- Your code chunk goes here -->



# Practice on Your Own!

Here are a few changes that will show you how to change small things in `R` code and the output it makes. After each change, hit the **Knit** button again.

### P.1

Update the options of the R chunk you just made (with the lowercase x in it) so that the output option is `show output only`. How does the chunk look now?
Go through the code for the plot above and change the colors in `palette` to something other than what they originally were. See http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a large list of colors. For example, you could replace blue with red.

### P.2

Create another R Markdown Document from RStudio dropdowns: File → New File → R Markdown.

### P.3

Add a new header with two hash symbols `##` at the start of a line with some text. Knit the report to see how it looks.
43 changes: 26 additions & 17 deletions modules/RStudio/lab/RStudio_Lab.html

Large diffs are not rendered by default.

57 changes: 26 additions & 31 deletions modules/RStudio/lab/RStudio_Lab_Key.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ editor_options:

# R Markdown

Please read through everything and then try the exercises. This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. The way you can create a file like this in RStudio is: File → New File → R Markdown and then using the default or using a template.
The file you are reading is called an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. The way you can create a file like this in RStudio is: File → New File → R Markdown and then using the default or using a template.

1. Try compiling this document using the “Knit” button. What files are produced?

### The Code

The gray area below is a code chunk that will set up our packages and data. You can also run the code within the editor area by pressing the green play button. Don't worry right now about what the code is doing, we will cover this later. We just want you to get used to RStudio and RMarkdowns. This dataset is one we'll be working with quite a lot in the lectures. It contains county-level data about ER visits for heat-related illnesses in Colorado for the years 2011-2022.

2. Press the green play button. What happens (check the environment too!)?

```{r setup, message=FALSE}
library(tidyverse)
Expand All @@ -22,30 +26,17 @@ er_2 <- er %>%
filter(!is.na(rate))
```

When you click the **Knit** button (at the top of RStudio), a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. Next we will show you some code - no worries about understanding it yet, we just want to get you familiar with where code goes. When code is in an RMarkdown file chunk, it is saved to a file. When it is in the console, it is not saved. The console is useful for installing packages like we just did, this is because we only need to do it once, so we don't usually need to save the code.
When you click the **Knit** button (at the top of RStudio), a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. Note that when it does this it starts from scratch - it can't use any objects you created outside of the Rmd file. Therefore it essentially has its own environment that is different from the one that you see when working interactively in RStudio.

### Plotting some data

Here is code that will make a plot of some data.You can embed an R code chunk like this: Try pressing the green play button to see what happens. Make sure you have run the previous code chunk first by pressing the green play button in that chunk.

```{r plot, out.width = "100%"}
# keep only some counties
er_3 <- er_2 %>%
filter(county %in% c("Arapahoe", "Denver", "Jefferson", "Larimer"))
Here is code that will make a plot of some data.

palette <- c(
Arapahoe = "blue",
Denver = "darkgreen",
Jefferson = "orange",
Larimer = "purple"
)
3. Try the "run all chunks above" button that is to the left of the play button on the following chunk. What happens?

ggplot(aes(x = year, y = rate, colour = county, group = county), data = er_3) +
geom_line() +
scale_colour_manual(values = palette)
```
4. Then press the play button on this same chunk. What happens?

```{r out.width = "100%", label = '0response'}
```{r out.width = "100%"}
# keep only some counties
er_3 <- er_2 %>%
filter(county %in% c("Arapahoe", "Denver", "Jefferson", "Larimer"))
Expand All @@ -62,31 +53,35 @@ ggplot(aes(x = year, y = rate, colour = county, group = county), data = er_3) +
scale_colour_manual(values = palette)
```

### Adding new chunks

# Exercise

Here are a few changes that will show you how to change small things in `R` code and the output it makes. After each change, hit the **Knit** button again.

### 1.1

Go through the code for the plot above and change the colors in `palette` to something other than what they originally were. See http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a large list of colors. For example, you could replace blue with red.

### 1.2

Add a new R chunk after `<!-- Your code chunk goes here -->`. You can use the insert chunk button or copy paste an existing code chunk. Include a lowercase x inside the chunk as the code. Make sure you press the knit button after this to see what the new chunk looks like.
5. Add a new R chunk after `<!-- Your code chunk goes here -->`. You can use the insert chunk button or copy paste an existing code chunk. Include a lowercase x inside the chunk as the code. Make sure you press the knit button after this to see what the new chunk looks like.

```{r}
x <- c(1, 2, 3)
```

<!-- Your code chunk goes here -->

```{r}
x
```


# Practice on Your Own!

Here are a few changes that will show you how to change small things in `R` code and the output it makes. After each change, hit the **Knit** button again.

### P.1

Update the options of the R chunk you just made (with the lowercase x in it) so that the output option is `show output only`. How does the chunk look now?
Go through the code for the plot above and change the colors in `palette` to something other than what they originally were. See http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf for a large list of colors. For example, you could replace blue with red.

### P.2

Create another R Markdown Document from RStudio dropdowns: File → New File → R Markdown.

### P.3

Add a new header with two hash symbols `##` at the start of a line with some text. Knit the report to see how it looks.

## New Header
Loading

0 comments on commit 40bba7e

Please sign in to comment.