Skip to content

Commit

Permalink
convert to .md
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed May 8, 2021
1 parent 4cccd80 commit 317be99
Show file tree
Hide file tree
Showing 39 changed files with 113 additions and 185 deletions.
2 changes: 1 addition & 1 deletion _book/a1-starting.html
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#rstudio" class="nav-link" data-bs-target="#rstudio"> <span class="header-section-number">A.3</span> RStudio</a></li>
<li><a href="#opening-r" class="nav-link" data-bs-target="#opening-r"> <span class="header-section-number">A.4</span> Opening R</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a1-starting.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a1-starting.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
2 changes: 1 addition & 1 deletion _book/a2-packages.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#installing-packages" class="nav-link" data-bs-target="#installing-packages"> <span class="header-section-number">B.1</span> Installing Packages</a></li>
<li><a href="#loading-packages" class="nav-link" data-bs-target="#loading-packages"> <span class="header-section-number">B.2</span> Loading Packages</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a2-packages.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a2-packages.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
2 changes: 1 addition & 1 deletion _book/a3-updating.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ <h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#r-packages" class="nav-link" data-bs-target="#r-packages"> <span class="header-section-number">C.1</span> R Packages</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a3-updating.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a3-updating.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
2 changes: 1 addition & 1 deletion _book/a4-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#connecting-to-databases" class="nav-link" data-bs-target="#connecting-to-databases"> <span class="header-section-number">D.6.13</span> Connecting to Databases</a></li>
</ul></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a4-data.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a4-data.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
2 changes: 1 addition & 1 deletion _book/a5-debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#trace" class="nav-link" data-bs-target="#trace"> <span class="header-section-number">E.5</span> trace</a></li>
<li><a href="#recover" class="nav-link" data-bs-target="#recover"> <span class="header-section-number">E.6</span> recover</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a5-debug.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/a5-debug.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
6 changes: 2 additions & 4 deletions _book/basics.html
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,7 @@ <h2 data-number="1.1" class="anchored" id="the-r-user-interface"><span class="he
</ol>
</div>
<p>Throughout the book, I’ll put exercises in chunks, like the one above. I’ll follow each exercise with a model answer, like the one below.</p>
<div class="cell">
<pre class="solution cell-code"><code>You could start with the number 10, and then do the following steps:
<pre class="{solution}"><code>You could start with the number 10, and then do the following steps:

10 + 2
## 12
Expand All @@ -470,7 +469,6 @@ <h2 data-number="1.1" class="anchored" id="the-r-user-interface"><span class="he

30 / 3
## 10</code></pre>
</div>
</section>
<section class="level2" data-number="0.2">
<h2 data-number="1.2" class="anchored" id="objects"><span class="header-section-number">1.2</span> Objects</h2>
Expand Down Expand Up @@ -908,7 +906,7 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#scripts" class="nav-link" data-bs-target="#scripts"><span class="toc-section-number">1.6</span> Scripts</a></li>
<li><a href="#summary" class="nav-link" data-bs-target="#summary"><span class="toc-section-number">1.7</span> Summary</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/basics.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/basics.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
14 changes: 4 additions & 10 deletions _book/environments.html
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,7 @@ <h2 data-number="6.5" class="anchored" id="evaluation"><span class="header-secti
<div id="exr:will-deal-work" class="theorem exercise">
<p><span class="theorem-title"><strong>Exercise 6.1 (Will deal work?) </strong></span>Will R be able to find <code>deck</code> and return an answer when I call the new version of <code>deal</code>, such as <code>deal()</code>?</p>
</div>
<div class="cell">
<pre class="solution cell-code"><code>Yes. `deal` will still work the same as before. R will run `deal` in a runtime environment that is a child of the global environment. Why will it be a child of the global environment? Because the global environment is the origin environment of `deal` (we defined `deal` in the global environment):</code></pre>
</div>
<pre class="{solution}"><code>Yes. `deal` will still work the same as before. R will run `deal` in a runtime environment that is a child of the global environment. Why will it be a child of the global environment? Because the global environment is the origin environment of `deal` (we defined `deal` in the global environment):</code></pre>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="fu">environment</span>(deal)</span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a><span class="do">## &lt;environment: R_GlobalEnv&gt;</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>When <code>deal</code> calls <code>deck</code>, R will need to look up the <code>deck</code> object. R’s scoping rules will lead it to the version of <code>deck</code> in the global environment, as in <a href="#fig:deal">fig.&nbsp;<span>6.5</span></a>. <code>deal</code> works as expected as a result:</p>
Expand Down Expand Up @@ -665,9 +663,7 @@ <h2 data-number="6.5" class="anchored" id="evaluation"><span class="header-secti
<div id="exr:overwrite-deck" class="theorem exercise">
<p><span class="theorem-title"><strong>Exercise 6.2 (Overwrite deck) </strong></span>Rewrite the <code>deck &lt;- deck[-1, ]</code> line of <code>deal</code> to <em>assign</em> <code>deck[-1, ]</code> to an object named <code>deck</code> in the global environment. Hint: consider the <code>assign</code> function.</p>
</div>
<div class="cell">
<pre class="solution cell-code"><code>You can assign an object to a specific environment with the `assign` function: </code></pre>
</div>
<pre class="{solution}"><code>You can assign an object to a specific environment with the `assign` function: </code></pre>
<div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>deal <span class="ot">&lt;-</span> <span class="cf">function</span>() {</span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a> card <span class="ot">&lt;-</span> deck[<span class="dv">1</span>, ]</span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">assign</span>(<span class="st">"deck"</span>, deck[<span class="sc">-</span><span class="dv">1</span>, ], <span class="at">envir =</span> <span class="fu">globalenv</span>())</span>
Expand Down Expand Up @@ -714,9 +710,7 @@ <h2 data-number="6.5" class="anchored" id="evaluation"><span class="header-secti
<div id="exr:rewrite-shuffle" class="theorem exercise">
<p><span class="theorem-title"><strong>Exercise 6.3 (Rewrite shuffle) </strong></span>Rewrite <code>shuffle</code> so that it replaces the copy of <code>deck</code> that lives in the global environment with a shuffled version of <code>DECK</code>, the intact copy of <code>deck</code> that also lives in the global environment. The new version of <code>shuffle</code> should have no arguments and return no output.</p>
</div>
<div class="cell">
<pre class="solution cell-code"><code>You can update `shuffle` in the same way that you updated `deck`. The following version will do the job: </code></pre>
</div>
<pre class="{solution}"><code>You can update `shuffle` in the same way that you updated `deck`. The following version will do the job: </code></pre>
<div class="sourceCode" id="cb35"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a>shuffle <span class="ot">&lt;-</span> <span class="cf">function</span>(){</span>
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a> random <span class="ot">&lt;-</span> <span class="fu">sample</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">52</span>, <span class="at">size =</span> <span class="dv">52</span>)</span>
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">assign</span>(<span class="st">"deck"</span>, DECK[random, ], <span class="at">envir =</span> <span class="fu">globalenv</span>())</span>
Expand Down Expand Up @@ -895,7 +889,7 @@ <h2 id="toc-title">Table of contents</h2>
<li><a href="#summary" class="nav-link" data-bs-target="#summary"><span class="toc-section-number">6.7</span> Summary</a></li>
<li><a href="#project-2-wrap-up" class="nav-link" data-bs-target="#project-2-wrap-up"><span class="toc-section-number">6.8</span> Project 2 Wrap-up</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/environments.rmd">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/rstudio-education/hopr/edit/main/environments.md">Edit this page</a></p></div></div></nav></div> <!-- /toc column -->
</div> <!-- /row -->
</div> <!-- /container fluid -->

Expand Down
Loading

0 comments on commit 317be99

Please sign in to comment.