Skip to content

Commit

Permalink
Render site
Browse files Browse the repository at this point in the history
  • Loading branch information
jhudsl-robot committed Jan 12, 2024
1 parent 827be20 commit 25ff378
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
8 changes: 4 additions & 4 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,16 @@ <h2><strong>Why are my changes not taking effect? It’s making my results
<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] 652 290 410 286 255</code></pre>
<pre><code>## [1] 445 735 430 425 652</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] 653 291 411 287 256</code></pre>
<pre><code>## [1] 446 736 431 426 653</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] 653 291 411 287 256</code></pre>
<pre><code>## [1] 446 736 431 426 653</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>
Expand Down Expand Up @@ -473,7 +473,7 @@ <h2><strong>Error: object ‘X’ not found</strong></h2>
operator:</p>
<pre class="r"><code>rivers2 &lt;- new_rivers + 1
rivers2</code></pre>
<pre><code>## [1] 654 292 412 288 257</code></pre>
<pre><code>## [1] 447 737 432 427 654</code></pre>
<hr />
</div>
<div id="error-unexpected-in-error-unexpected-in-error-unexpected-x-in"
Expand Down
27 changes: 14 additions & 13 deletions modules/Data_Classes/Data_Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3666,22 +3666,23 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>

<p><code>as.matrix()</code> creates a matrix from a data frame or tibble (where all values are the same class).</p>

<pre class = 'prettyprint lang-r'>head(iris, n = 3)</pre>
<pre class = 'prettyprint lang-r'>circ_mat &lt;- select(circ, contains(&quot;orange&quot;)) %&gt;%
head(n = 3)
circ_mat</pre>

<pre >## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa</pre>
<pre >## # A tibble: 3 × 3
## orangeBoardings orangeAlightings orangeAverage
## &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
## 1 877 1027 952
## 2 777 815 796
## 3 1203 1220 1212.</pre>

<pre class = 'prettyprint lang-r'>iris_mat &lt;- select(iris, -Species) %&gt;%
tibble() %&gt;%
head(n = 3)
as.matrix(iris_mat)</pre>
<pre class = 'prettyprint lang-r'>as.matrix(circ_mat)</pre>

<pre >## Sepal.Length Sepal.Width Petal.Length Petal.Width
## [1,] 5.1 3.5 1.4 0.2
## [2,] 4.9 3.0 1.4 0.2
## [3,] 4.7 3.2 1.3 0.2</pre>
<pre >## orangeBoardings orangeAlightings orangeAverage
## [1,] 877 1027 952.0
## [2,] 777 815 796.0
## [3,] 1203 1220 1211.5</pre>

</article></slide><slide class=""><hgroup><h2>Matrices</h2></hgroup><article id="matrices-1">

Expand Down

0 comments on commit 25ff378

Please sign in to comment.