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 Oct 9, 2024
1 parent 924b785 commit 1f8c32a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 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] 300 310 1243 215 1100</code></pre>
<pre><code>## [1] 2348 600 444 981 338</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] 301 311 1244 216 1101</code></pre>
<pre><code>## [1] 2349 601 445 982 339</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] 301 311 1244 216 1101</code></pre>
<pre><code>## [1] 2349 601 445 982 339</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] 302 312 1245 217 1102</code></pre>
<pre><code>## [1] 2350 602 446 983 340</code></pre>
<hr />
</div>
<div id="error-unexpected-in-error-unexpected-in-error-unexpected-x-in" class="section level2">
Expand Down
6 changes: 4 additions & 2 deletions modules/Statistics/lab/Statistics_Lab.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Change your code from 1.2 to add a few more variables:

Perform a t-test to determine if there is evidence of a difference between low birth weight percentage (`LowBirthWeight`) in Los Angeles census tracts compared to San Diego:

* Create a subset of the data for CaliforniaCounty == "Los Angeles"
* Create a subset of the data for CaliforniaCounty == "San Diego"
* Create a subset of the data for `CaliforniaCounty == "Los Angeles"`
* Create a subset of the data for `CaliforniaCounty == "San Diego"`
* `pull` the `LowBirthWeight` column for both subsets
* Use `t.test` to compare the two pulled vectors
* Print the results using the `tidy` function from the `broom` package
Expand Down Expand Up @@ -141,6 +141,8 @@ Let's make `LowBirthWeight` into a binary variable, where over 5% low birth weig
The following code creates a column `weight_cat` with TRUE/FALSE values.

```{r}
ces <- read_csv("https://daseh.org/data/CalEnviroScreen_data.csv")
ces_bw <-
ces %>%
mutate(weight_cat = LowBirthWeight > 5)
Expand Down
13 changes: 11 additions & 2 deletions modules/Statistics/lab/Statistics_Lab_Key.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ <h3>1.3</h3>
<h3>1.4</h3>
<p>Perform a t-test to determine if there is evidence of a difference between low birth weight percentage (<code>LowBirthWeight</code>) in Los Angeles census tracts compared to San Diego:</p>
<ul>
<li>Create a subset of the data for CaliforniaCounty == Los Angeles</li>
<li>Create a subset of the data for CaliforniaCounty == San Diego</li>
<li>Create a subset of the data for <code>CaliforniaCounty == &quot;Los Angeles&quot;</code></li>
<li>Create a subset of the data for <code>CaliforniaCounty == &quot;San Diego&quot;</code></li>
<li><code>pull</code> the <code>LowBirthWeight</code> column for both subsets</li>
<li>Use <code>t.test</code> to compare the two pulled vectors</li>
<li>Print the results using the <code>tidy</code> function from the <code>broom</code> package</li>
Expand Down Expand Up @@ -409,6 +409,15 @@ <h3>P.3</h3>
<h3>P.4</h3>
<p>Let’s make <code>LowBirthWeight</code> into a binary variable, where over 5% low birth weight is “TRUE”.</p>
<p>The following code creates a column <code>weight_cat</code> with TRUE/FALSE values.</p>
<pre class="r"><code>ces &lt;- read_csv(&quot;https://daseh.org/data/CalEnviroScreen_data.csv&quot;)</code></pre>
<pre><code>## Rows: 8035 Columns: 67
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: &quot;,&quot;
## chr (3): CaliforniaCounty, ApproxLocation, CES4.0PercRange
## dbl (64): CensusTract, ZIP, Longitude, Latitude, CES4.0Score, CES4.0Percenti...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
<pre class="r"><code>ces_bw &lt;-
ces %&gt;%
mutate(weight_cat = LowBirthWeight &gt; 5)</code></pre>
Expand Down

0 comments on commit 1f8c32a

Please sign in to comment.