Skip to content

Commit

Permalink
Merge branch 'handbook_v2.5_en' of https://github.com/appliedepi/epiR…
Browse files Browse the repository at this point in the history
…handbook_eng into handbook_v2.5_en
  • Loading branch information
ntluong95 committed Oct 29, 2024
2 parents 013d232 + e6a4aa9 commit 0670a27
Show file tree
Hide file tree
Showing 137 changed files with 19,311 additions and 6,697 deletions.
2 changes: 1 addition & 1 deletion .Rhistory
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
############
learnr, # interactive tutorials in RStudio Tutorial pane
swirl, # interactive tutorials in R console
# project and file management
Expand Down Expand Up @@ -510,3 +509,4 @@ bookdown::render_book(
output_format = 'bookdown::bs4_book',
config_file = "_bookdown.yml")
renv::status()
here("data", "linelists", "linelist_raw.xlsx")
2 changes: 1 addition & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ book:
- icon: twitter
href: "https://twitter.com/appliedepi"
- icon: linkedin
href: "https://www.linkedin.com/company/appliedepi/"
href: "https://www.linkedin.com/company/appliedepi"
# - icon: github
# menu:
# - text: Source Code
Expand Down
6 changes: 3 additions & 3 deletions html_outputs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,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 @@ -725,7 +725,7 @@ <h1 class="title">The Epidemiologist R Handbook</h1>
<div>
<div class="quarto-title-meta-heading">Last updated</div>
<div class="quarto-title-meta-contents">
<p class="date">Oct 1, 2024</p>
<p class="date">Oct 18, 2024</p>
</div>
</div>

Expand Down Expand Up @@ -1463,7 +1463,7 @@ <h3 class="unnumbered anchored" data-anchor-id="contribution">Contribution</h3>
</div>
</div>
</footer>
<script>var lightboxQuarto = GLightbox({"openEffect":"zoom","descPosition":"bottom","selector":".lightbox","loop":false,"closeEffect":"zoom"});
<script>var lightboxQuarto = GLightbox({"selector":".lightbox","closeEffect":"zoom","descPosition":"bottom","openEffect":"zoom","loop":false});
(function() {
let previousOnload = window.onload;
window.onload = () => {
Expand Down
20 changes: 10 additions & 10 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 @@ -1249,7 +1249,7 @@ <h3 class="unnumbered anchored" data-anchor-id="functions-with-multiple-argument
<ul>
<li>Show proportions instead of counts (set <code>proportional = TRUE</code> when the default is <code>FALSE</code>)<br>
</li>
<li>Specify the two colors to use (<code>pal =</code> is short for “palette” and is supplied with a vector of two color names. See the <a href="https://epirhandbook.com/new_pages/basics.html#objects">objects</a> page for how the function <code>c()</code> makes a vector)</li>
<li>Specify the two colors to use (<code>pal =</code> is short for “palette” and is supplied with a vector of two color names. See the <a href="../new_pages/basics.html#objects">objects</a> page for how the function <code>c()</code> makes a vector)</li>
</ul>
<p><span style="color: black;"><strong><em>NOTE:</em></strong> For arguments that you specify with both parts of the argument (e.g.&nbsp;<code>proportional = TRUE</code>), their order among all the arguments does not matter.</span></p>
<div class="cell">
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 All @@ -1327,7 +1327,7 @@ <h3 class="unnumbered anchored" data-anchor-id="install-and-load">Install and lo
</ol>
<section id="your-library" class="level4 unnumbered">
<h4 class="unnumbered anchored" data-anchor-id="your-library">Your library</h4>
<p>Your “library” is actually a folder on your computer, containing a folder for each package that has been installed. Find out where R is installed in your computer, and look for a folder called “win-library”. For example: <code>R\win-library\4.4.1</code> (the 4.4.1 is the R version - you’ll have a different library for each R version you’ve downloaded).</p>
<p>Your “library” is actually a folder on your computer, containing a folder for each package that has been installed. Find out where R is installed in your computer, and look for a folder called “library”. For example: <code>R\4.4.1\library</code> (the 4.4.1 is the R version - you’ll have a different library for each R version you’ve downloaded).</p>
<p>You can print the file path to your library by entering <code>.libPaths()</code> (empty parentheses). This becomes especially important if working with <a href="../new_pages/network_drives.html">R on network drives</a>.</p>
</section>
<section id="install-from-cran" class="level4 unnumbered">
Expand Down Expand Up @@ -1362,9 +1362,9 @@ <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>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="../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>
<p>To install from Github, you have to provide more information. You must provide:</p>
<ol type="1">
Expand Down Expand Up @@ -1738,7 +1738,7 @@ <h3 class="unnumbered anchored" data-anchor-id="defining-objects--">Defining obj
</div>
</div>
<p><strong>Columns</strong></p>
<p>Columns in a dataset are also objects and can be defined, over-written, and created as described below in the section on <a href="https://epirhandbook.com/new_pages/basics.html#columnsvariables">Columns</a>.</p>
<p>Columns in a dataset are also objects and can be defined, over-written, and created as described below in the section on <a href="../new_pages/basics.html#columnsvariables">Columns</a>.</p>
<p>You can use the assignment operator from <strong>base</strong> R to create a new column. Below, the new column <code>bmi</code> (Body Mass Index) is created, and for each row the new value is result of a mathematical operation on the row’s value in the <code>wt_kg</code> and <code>ht_cm</code> columns.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb34"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a><span class="co"># create new "bmi" column using base R syntax</span></span>
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","closeEffect":"zoom","loop":false,"openEffect":"zoom","selector":".lightbox"});
(function() {
let previousOnload = window.onload;
window.onload = () => {
Expand Down
101 changes: 44 additions & 57 deletions html_outputs/new_pages/characters_strings.html

Large diffs are not rendered by default.

162 changes: 68 additions & 94 deletions html_outputs/new_pages/cleaning.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions html_outputs/new_pages/collaboration.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 @@ -1236,7 +1236,7 @@ <h2 data-number="47.9" class="anchored" data-anchor-id="pull-and-push-changes-up
<section id="in-rstudio-3" class="level4 unnumbered">
<h4 class="unnumbered anchored" data-anchor-id="in-rstudio-3">In Rstudio</h4>
<p><em>PULL</em> - First, click the “Pull” icon (downward arrow) which fetches and pulls at the same time.</p>
<p><em>PUSH</em> - Clicking the green “Pull” icon (upward arrow). You may be asked to enter your Github username and password. The first time you are asked, you may need to enter two Git command lines into the <em>Terminal</em>:</p>
<p><em>PUSH</em> - Clicking the green “Push” icon (upward arrow). You may be asked to enter your Github username and password. The first time you are asked, you may need to enter two Git command lines into the <em>Terminal</em>:</p>
<ul>
<li><strong>git config –global user.email “<a href="mailto:you@example.com" class="email">you@example.com</a></strong> (your Github email address), and<br>
</li>
Expand Down Expand Up @@ -2214,7 +2214,7 @@ <h2 data-number="47.13" class="anchored" data-anchor-id="resources"><span class=
</div>
</div>
</footer>
<script>var lightboxQuarto = GLightbox({"selector":".lightbox","closeEffect":"zoom","openEffect":"zoom","loop":false,"descPosition":"bottom"});
<script>var lightboxQuarto = GLightbox({"openEffect":"zoom","descPosition":"bottom","selector":".lightbox","closeEffect":"zoom","loop":false});
(function() {
let previousOnload = window.onload;
window.onload = () => {
Expand Down
Loading

0 comments on commit 0670a27

Please sign in to comment.