Skip to content

Commit

Permalink
Render site
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 6, 2024
1 parent 96277ff commit 68e5450
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 52 deletions.
8 changes: 4 additions & 4 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,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] 250 380 444 1054 350</code></pre>
<pre><code>## [1] 327 1885 460 3710 280</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] 251 381 445 1055 351</code></pre>
<pre><code>## [1] 328 1886 461 3711 281</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] 251 381 445 1055 351</code></pre>
<pre><code>## [1] 328 1886 461 3711 281</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 @@ -409,7 +409,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] 252 382 446 1056 352</code></pre>
<pre><code>## [1] 329 1887 462 3712 282</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-12-05.</p>
<p>This page was last updated on 2024-12-06.</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
122 changes: 86 additions & 36 deletions modules/Subsetting_Data_in_R/Subsetting_Data_in_R.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions modules/Subsetting_Data_in_R/lab/Subsetting_Data_in_R_Lab.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Subset the rows of `ces_sub` that have **more** than 100 for `Asthma` - how many

### 2.5

Subset the rows of `ces_sub` that have a `Traffic` value **less** than 500 and an `Asthma` value **more** than 100 - how many are there?
Subset the rows of `ces_sub` that have an `Asthma` value **more** than 100 and a `Traffic` value **less** than 500 and — how many are there?


```{r 2.5response}
Expand All @@ -134,7 +134,7 @@ Subset the rows of `ces_sub` that have a `Traffic` value **less** than 500 and a

### 2.6

Subset the rows of `ces_sub` that have a `Traffic` value **less than or equal to** 500 and an `Asthma` value **more** than 100 - how many are there?
Subset the rows of `ces_sub` that have an `Asthma` value **more** than 100 and a `Traffic` value **less than or equal to (`<=`)** 500 — how many are there?

```{r 2.6response}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,13 @@ <h3>2.3</h3>
<div id="section-7" class="section level3">
<h3>2.4</h3>
<p>Subset the rows of <code>ces_sub</code> that have <strong>more</strong> than 100 for <code>Asthma</code> - how many rows are there? Use <code>filter()</code>.</p>
<pre class="r"><code>ces_sub &lt;- filter(ces_sub, Asthma &gt; 100)
nrow(ces_sub)</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Asthma &gt; 100))</code></pre>
<pre><code>## [1] 592</code></pre>
</div>
<div id="section-8" class="section level3">
<h3>2.5</h3>
<p>Subset the rows of <code>ces_sub</code> that have a <code>Traffic</code> value <strong>less</strong> than 500 and an <code>Asthma</code> value <strong>more</strong> than 100 - how many are there?</p>
<pre class="r"><code>filter(ces_sub, Traffic &lt; 500 &amp; Asthma &gt; 100) # all of these options work</code></pre>
<p>Subset the rows of <code>ces_sub</code> that have an <code>Asthma</code> value <strong>more</strong> than 100 and a <code>Traffic</code> value <strong>less</strong> than 500 and — how many are there?</p>
<pre class="r"><code>filter(ces_sub, Asthma &gt; 100 &amp; Traffic &lt; 500) # all of these options work</code></pre>
<pre><code>## # A tibble: 130 × 3
## CensusTract Traffic Asthma
## &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
Expand All @@ -384,14 +383,14 @@ <h3>2.5</h3>
## 9 6001407600 311. 115.
## 10 6001408200 437. 187.
## # ℹ 120 more rows</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Traffic &lt; 500 &amp; Asthma &gt; 100))</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Asthma &gt; 100 &amp; Traffic &lt; 500))</code></pre>
<pre><code>## [1] 130</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Traffic &lt; 500, Asthma &gt; 100))</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Asthma &gt; 100, Traffic &lt; 500))</code></pre>
<pre><code>## [1] 130</code></pre>
</div>
<div id="section-9" class="section level3">
<h3>2.6</h3>
<p>Subset the rows of <code>ces_sub</code> that have a <code>Traffic</code> value <strong>less than or equal to</strong> 500 and an <code>Asthma</code> value <strong>more</strong> than 100 - how many are there?</p>
<p>Subset the rows of <code>ces_sub</code> that have an <code>Asthma</code> value <strong>more</strong> than 100 and a <code>Traffic</code> value <strong>less than or equal to (<code>&lt;=</code>)</strong> 500 — how many are there?</p>
<pre class="r"><code>filter(ces_sub, Traffic &lt;= 500 &amp; Asthma &gt; 100) # all of these options work</code></pre>
<pre><code>## # A tibble: 130 × 3
## CensusTract Traffic Asthma
Expand All @@ -407,9 +406,9 @@ <h3>2.6</h3>
## 9 6001407600 311. 115.
## 10 6001408200 437. 187.
## # ℹ 120 more rows</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Traffic &lt;= 500 &amp; Asthma &gt; 100))</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Asthma &gt; 100 &amp; Traffic &lt;= 500))</code></pre>
<pre><code>## [1] 130</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Traffic &lt;= 500, Asthma &gt; 100))</code></pre>
<pre class="r"><code>nrow(filter(ces_sub, Asthma &gt; 100, Traffic &lt;= 500))</code></pre>
<pre><code>## [1] 130</code></pre>
</div>
<div id="section-10" class="section level3">
Expand Down

0 comments on commit 68e5450

Please sign in to comment.