Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jhudsl/intro_to_r
Browse files Browse the repository at this point in the history
  • Loading branch information
avahoffman committed Jan 6, 2025
2 parents 2bb405b + 564a358 commit 95083cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,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] 350 652 500 570 435</code></pre>
<pre><code>## [1] 315 625 490 2533 680</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] 351 653 501 571 436</code></pre>
<pre><code>## [1] 316 626 491 2534 681</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] 351 653 501 571 436</code></pre>
<pre><code>## [1] 316 626 491 2534 681</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 @@ -403,7 +403,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] 352 654 502 572 437</code></pre>
<pre><code>## [1] 317 627 492 2535 682</code></pre>
<hr />
</div>
<div id="error-unexpected-in-error-unexpected-in-error-unexpected-x-in" class="section level2">
Expand Down
Binary file modified modules/Intro/Intro.pdf
Binary file not shown.

0 comments on commit 95083cc

Please sign in to comment.