Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Oct 2, 2023
1 parent a6e2233 commit bd93250
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cd47a0ed
9746f900
Binary file modified Building-reproducible-analytical-pipelines-with-R.epub
Binary file not shown.
Binary file modified Building-reproducible-analytical-pipelines-with-R.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions fprog.html
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,8 @@ <h3 data-number="6.2.1" class="anchored" data-anchor-id="functions-are-first-cla
<div class="sourceCode cell-code" id="cb74"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb74-1"><a href="#cb74-1" aria-hidden="true" tabindex="-1"></a>chronicler<span class="sc">::</span><span class="fu">read_log</span>(result)</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] "Complete log:"
[2] "NOK! sqrt() ran unsuccessfully with following exception: NaNs produced at 2023-10-02 14:25:55"
[3] "Total running time: 0.00110697746276855 secs" </code></pre>
[2] "NOK! sqrt() ran unsuccessfully with following exception: NaNs produced at 2023-10-02 14:58:09"
[3] "Total running time: 0.00138974189758301 secs" </code></pre>
</div>
</div>
<p>The <code>{purrr}</code> package also comes with function factories that you might find useful (<code>{possibly}</code>, <code>{safely}</code> and <code>{quietly}</code>).</p>
Expand Down Expand Up @@ -1679,7 +1679,7 @@ <h3 data-number="6.4.1" class="anchored" data-anchor-id="base-capabilities"><spa
<div class="cell-output cell-output-stdout">
<pre><code>function (x, ...)
UseMethod("print")
&lt;bytecode: 0x5615c3c8b448&gt;
&lt;bytecode: 0x55c8f2e556d0&gt;
&lt;environment: namespace:base&gt;</code></pre>
</div>
</div>
Expand Down Expand Up @@ -1723,7 +1723,7 @@ <h3 data-number="6.4.1" class="anchored" data-anchor-id="base-capabilities"><spa
}
invisible(x)
}
&lt;bytecode: 0x5615c4607088&gt;
&lt;bytecode: 0x55c8f37dbef8&gt;
&lt;environment: namespace:base&gt;</code></pre>
</div>
</div>
Expand Down
29 changes: 17 additions & 12 deletions project_rewrite.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ <h2 data-number="9.1" class="anchored" data-anchor-id="an-rmd-for-cleaning-the-d
<span id="cb8-28"><a href="#cb8-28" aria-hidden="true" tabindex="-1"></a> <span class="at">average_price_m2_nominal_euros =</span> prix_moyen_annonce_au_m2_en_courant</span>
<span id="cb8-29"><a href="#cb8-29" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">|&gt;</span></span>
<span id="cb8-30"><a href="#cb8-30" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">locality =</span> <span class="fu">str_trim</span>(locality)) <span class="sc">|&gt;</span></span>
<span id="cb8-31"><a href="#cb8-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(year, locality, n_offers, <span class="fu">starts_with</span>(<span class="st">"average"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb8-31"><a href="#cb8-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(year, locality, n_offers, <span class="fu">starts_with</span>(<span class="st">"average"</span>))</span>
<span id="cb8-32"><a href="#cb8-32" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>and here is the same code, but as a function:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>```{r, eval = FALSE}</span>
Expand Down Expand Up @@ -545,17 +546,21 @@ <h2 data-number="9.1" class="anchored" data-anchor-id="an-rmd-for-cleaning-the-d
<span id="cb12-32"><a href="#cb12-32" aria-hidden="true" tabindex="-1"></a> table_position = 2</span>
<span id="cb12-33"><a href="#cb12-33" aria-hidden="true" tabindex="-1"></a> ){</span>
<span id="cb12-34"><a href="#cb12-34" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-35"><a href="#cb12-35" aria-hidden="true" tabindex="-1"></a> read_html(url) %&gt;%</span>
<span id="cb12-36"><a href="#cb12-36" aria-hidden="true" tabindex="-1"></a> html_table() %&gt;%</span>
<span id="cb12-37"><a href="#cb12-37" aria-hidden="true" tabindex="-1"></a> pluck(table_position) %&gt;%</span>
<span id="cb12-38"><a href="#cb12-38" aria-hidden="true" tabindex="-1"></a> clean_names()</span>
<span id="cb12-39"><a href="#cb12-39" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb12-40"><a href="#cb12-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-41"><a href="#cb12-41" aria-hidden="true" tabindex="-1"></a>```</span>
<span id="cb12-35"><a href="#cb12-35" aria-hidden="true" tabindex="-1"></a> read_html(url) |&gt;</span>
<span id="cb12-36"><a href="#cb12-36" aria-hidden="true" tabindex="-1"></a> html_table() |&gt;</span>
<span id="cb12-37"><a href="#cb12-37" aria-hidden="true" tabindex="-1"></a> pluck(table_position) |&gt;</span>
<span id="cb12-38"><a href="#cb12-38" aria-hidden="true" tabindex="-1"></a> clean_names() |&gt;</span>
<span id="cb12-39"><a href="#cb12-39" aria-hidden="true" tabindex="-1"></a> filter(name_2 != "Name") |&gt;</span>
<span id="cb12-40"><a href="#cb12-40" aria-hidden="true" tabindex="-1"></a> rename(commune = name_2) |&gt;</span>
<span id="cb12-41"><a href="#cb12-41" aria-hidden="true" tabindex="-1"></a> mutate(commune = str_remove(commune, " .$"))</span>
<span id="cb12-42"><a href="#cb12-42" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-43"><a href="#cb12-43" aria-hidden="true" tabindex="-1"></a>```{r}</span>
<span id="cb12-44"><a href="#cb12-44" aria-hidden="true" tabindex="-1"></a>current_communes &lt;- get_current_communes()</span>
<span id="cb12-45"><a href="#cb12-45" aria-hidden="true" tabindex="-1"></a>```</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb12-43"><a href="#cb12-43" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb12-44"><a href="#cb12-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-45"><a href="#cb12-45" aria-hidden="true" tabindex="-1"></a>```</span>
<span id="cb12-46"><a href="#cb12-46" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-47"><a href="#cb12-47" aria-hidden="true" tabindex="-1"></a>```{r}</span>
<span id="cb12-48"><a href="#cb12-48" aria-hidden="true" tabindex="-1"></a>current_communes &lt;- get_current_communes()</span>
<span id="cb12-49"><a href="#cb12-49" aria-hidden="true" tabindex="-1"></a>```</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>This is quite a long chunk, but there is nothing new in here, so I won’t explain it line by line. What’s important is that the code doing the actual work is all being wrapped inside functions. I reiterate: this will make reusing, testing and documenting much easier later on. Using the objects <code>former_communes</code> and <code>current_communes</code> we can now build the complete list:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>Let’s now create a list of all communes:</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a></span>
Expand All @@ -570,7 +575,7 @@ <h2 data-number="9.1" class="anchored" data-anchor-id="an-rmd-for-cleaning-the-d
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Clemency")] &lt;- "Clémency"</span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Redange")] &lt;- "Redange-sur-Attert"</span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Erpeldange-sur-Sûre")] &lt;- "Erpeldange"</span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Luxembourg-City")] &lt;- "Luxembourg"</span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Luxembourg City")] &lt;- "Luxembourg"</span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Käerjeng")] &lt;- "Kaerjeng"</span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a> communes[which(communes == "Petange")] &lt;- "Pétange"</span>
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a></span>
Expand Down
Loading

0 comments on commit bd93250

Please sign in to comment.