Skip to content

Commit

Permalink
Updates to make sure github issues have been addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
arranhamlet committed Oct 15, 2024
1 parent fca5341 commit 259560d
Show file tree
Hide file tree
Showing 30 changed files with 1,783 additions and 1,698 deletions.
12 changes: 6 additions & 6 deletions html_outputs/new_pages/basics.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
<a href="../">The Epidemiologist R Handbook</a>
<div class="sidebar-tools-main tools-wide">
<a href="https://twitter.com/appliedepi" title="" class="quarto-navigation-tool px-1" aria-label=""><i class="bi bi-twitter"></i></a>
<a href="https://www.linkedin.com/company/appliedepi/" title="" class="quarto-navigation-tool px-1" aria-label=""><i class="bi bi-linkedin"></i></a>
<a href="https://www.linkedin.com/company/appliedepi" title="" class="quarto-navigation-tool px-1" aria-label=""><i class="bi bi-linkedin"></i></a>
<a href="https://github.com/appliedepi/epihandbook_eng" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-github"></i></a>
<div class="dropdown">
<a href="" title="Share" id="quarto-navigation-tool-dropdown-0" class="quarto-navigation-tool dropdown-toggle px-1" data-bs-toggle="dropdown" aria-expanded="false" role="link" aria-label="Share"><i class="bi bi-share"></i></a>
Expand Down Expand Up @@ -1318,7 +1318,7 @@ <h2 data-number="3.7" class="anchored" data-anchor-id="packages"><span class="he
<section id="install-and-load" class="level3 unnumbered">
<h3 class="unnumbered anchored" data-anchor-id="install-and-load">Install and load</h3>
<p><em>Functions</em> are contained within <strong>packages</strong> which can be downloaded (“installed”) to your computer from the internet. Once a package is downloaded, it is stored in your “library”. You can then access the functions it contains during your current R session by “loading” the package.</p>
<p><em>Think of R as your personal library</em>: When you download a package, your library gains a new book of functions, but each time you want to use a function in that book, you must borrow,“load”, that book from your library.</p>
<p><em>Think of R as your personal library</em>: When you download a package, your library gains a new book of functions, but each time you want to use a function in that book, you must borrow, “load”, that book from your library.</p>
<p>In summary: to use the functions available in an R package, 2 steps must be implemented:</p>
<ol type="1">
<li>The package must be <strong>installed</strong> (once), <em>and</em><br>
Expand Down Expand Up @@ -1362,7 +1362,7 @@ <h4 class="unnumbered anchored" data-anchor-id="how-to-install-and-load">How to
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(rio)</span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(here)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>To check whether a package in installed or loaded, you can view the Packages pane in RStudio. If the package is installed, it is shown there with version number. If its box is checked, it is loaded for the current session.</p>
<p>To check whether a package is installed or loaded, you can view the Packages pane in RStudio. If the package is installed, it is shown there with version number. If its box is checked, it is loaded for the current session.</p>
<p><strong>Install from Github</strong></p>
<p>Sometimes, you need to install a package that is not yet available from CRAN. Or perhaps the package is available on CRAN but you want the <em>development version</em> with new features not yet offered in the more stable published CRAN version. These are often hosted on the website <a href="https://github.com/">github.com</a> in a free, public-facing code “repository”. Read more about Github in the handbook page on <a href="https://epirhandbook.com/new_pages/collaboration.html">Version control and collaboration with Git and Github</a>.</p>
<p>To download R packages from Github, you can use the function <code>p_load_gh()</code> from <strong>pacman</strong>, which will install the package if necessary, and load it for use in your current R session. Alternatives to install include using the <strong>remotes</strong> or <strong>devtools</strong> packages. Read more about all the <strong>pacman</strong> functions in the <a href="https://cran.r-project.org/web/packages/pacman/pacman.pdf">package documentation</a>.</p>
Expand Down Expand Up @@ -1884,7 +1884,7 @@ <h3 class="unnumbered anchored" data-anchor-id="object-classes">Object classes</
</div>
<p>Sometimes, a column will be converted to a different class automatically by R. Watch out for this! For example, if you have a vector or column of numbers, but a character value is inserted… the entire column will change to class character.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb42"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a>num_vector <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="dv">1</span>, <span class="dv">2</span> , <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">5</span>) <span class="co"># define vector as all numbers</span></span>
<div class="sourceCode cell-code" id="cb42"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a>num_vector <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">5</span>) <span class="co"># define vector as all numbers</span></span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a><span class="fu">class</span>(num_vector) <span class="co"># vector is numeric class</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "numeric"</code></pre>
Expand Down Expand Up @@ -2140,7 +2140,7 @@ <h3 class="unnumbered anchored" data-anchor-id="pipes"><strong>Pipes</strong></h
<p>Pipe operators were first introduced through the <a href="https://magrittr.tidyverse.org/">magrittr package</a>, which is part of tidyverse, and were specified as <code>%&gt;%</code>. In R 4.1.0, they introduced a <strong>base</strong> R pipe which is specified through <code>|&gt;</code>. The behaviour of the two pipes is the same, and they can be used somewhat interchangeably. However, there are a few key differences.</p>
<ul>
<li>The <code>%&gt;%</code> pipe allows you to pass multiple arguments.</li>
<li>The <code>%&gt;%</code> pipe lets you drop parenthesis when calling a function with no other arguments (i.e.&nbsp;drop vs drop()).</li>
<li>The <code>%&gt;%</code> pipe lets you drop parentheses when calling a function with no other arguments (i.e.&nbsp;<code>drop</code> vs <code>drop()</code>).</li>
<li>The <code>%&gt;%</code> pipe allows you to start a pipe with <code>.</code> to create a function in your linking of code.</li>
</ul>
<p>For these reasons, we recommend the <strong>magrittr</strong> pipe, <code>%&gt;%</code>, over the <strong>base</strong> R pipe, <code>|&gt;</code>.</p>
Expand Down Expand Up @@ -3348,7 +3348,7 @@ <h3 class="unnumbered anchored" data-anchor-id="code-assists">Code assists</h3>
</div>
</div>
</footer>
<script>var lightboxQuarto = GLightbox({"loop":false,"openEffect":"zoom","closeEffect":"zoom","descPosition":"bottom","selector":".lightbox"});
<script>var lightboxQuarto = GLightbox({"descPosition":"bottom","openEffect":"zoom","loop":false,"selector":".lightbox","closeEffect":"zoom"});
(function() {
let previousOnload = window.onload;
window.onload = () => {
Expand Down
Loading

0 comments on commit 259560d

Please sign in to comment.