Skip to content

Commit

Permalink
Deploying to gh-pages from @ a1eedc8 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 20, 2023
1 parent 1ed48ef commit b075b06
Show file tree
Hide file tree
Showing 44 changed files with 1,123 additions and 121 deletions.
5 changes: 5 additions & 0 deletions argument-clutter.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down
5 changes: 5 additions & 0 deletions boolean-strategies.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down
5 changes: 5 additions & 0 deletions call-data-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down
13 changes: 9 additions & 4 deletions changes-multivers.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<i class="bi bi-layout-text-sidebar-reverse"></i>
</button>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./changes-multivers.html">Evolution</a></li><li class="breadcrumb-item"><a href="./changes-multivers.html"><span class="chapter-number">31</span>&nbsp; <span class="chapter-title">Work with multiple dependency versions</span></a></li></ol></nav>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./changes-multivers.html">Evolution</a></li><li class="breadcrumb-item"><a href="./changes-multivers.html"><span class="chapter-number">32</span>&nbsp; <span class="chapter-title">Work with multiple dependency versions</span></a></li></ol></nav>
<a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
</a>
<button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
Expand Down Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down Expand Up @@ -526,9 +531,9 @@ <h1 class="title"><span class="chapter-title">Work with multiple dependency vers
<span><span class="co">#&gt; # A tibble: 3 × 5</span></span>
<span><span class="co">#&gt; expression min median `itr/sec` mem_alloc</span></span>
<span><span class="co">#&gt; &lt;bch:expr&gt; &lt;bch:tm&gt; &lt;bch:tm&gt; &lt;dbl&gt; &lt;bch:byt&gt;</span></span>
<span><span class="co">#&gt; 1 version 495.2µs 510.2µs 1934. 4.01KB</span></span>
<span><span class="co">#&gt; 2 exists 3.4µs 3.7µs 246887. 3.29MB</span></span>
<span><span class="co">#&gt; 3 formals 1.5µs 1.7µs 473085. 0B</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span><span class="co">#&gt; 1 version 320.32µs 335.98µs 2924. 4.01KB</span></span>
<span><span class="co">#&gt; 2 exists 2.55µs 2.81µs 327007. 3.29MB</span></span>
<span><span class="co">#&gt; 3 formals 1.28µs 1.39µs 596045. 0B</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>If you do need to use <code><a href="https://rdrr.io/r/utils/packageDescription.html">packageVersion()</a></code> inside a performance sensitive function, I recommend caching the result in <code>.onLoad()</code> (which, by convention, lives in <code>zzz.R</code>). There a few ways to do this; but the following block shows one approach that matches the function interface I used above:</p>
<div class="cell">
Expand Down
9 changes: 7 additions & 2 deletions cs-mapply-pmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<i class="bi bi-layout-text-sidebar-reverse"></i>
</button>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./cs-mapply-pmap.html"><span class="chapter-number">25</span>&nbsp; <span class="chapter-title">Case study: `mapply()` vs `pmap()`</span></a></li></ol></nav>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./cs-mapply-pmap.html"><span class="chapter-number">26</span>&nbsp; <span class="chapter-title">Case study: `mapply()` vs `pmap()`</span></a></li></ol></nav>
<a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
</a>
<button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
Expand Down Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down Expand Up @@ -487,7 +492,7 @@ <h1 class="title"><span class="chapter-title">Case study: <code>mapply()</code>
<span><span class="co">#&gt; [1] "axxle" "bafafa" "cqerry"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>There’s a subtle difference here that doesn’t matter in most cases - in the <code><a href="https://rdrr.io/r/base/mapply.html">mapply()</a></code> <code>fixed</code> is recycled to the same length as <code>pattern</code> whereas it is not <code><a href="https://purrr.tidyverse.org/reference/pmap.html">pmap()</a></code>. TODO: figure out example where that’s more clear.</p>
<p>(Also note that <code><a href="https://purrr.tidyverse.org/reference/pmap.html">pmap()</a></code> uses the <code>.</code> prefix to avoid the problem described in Chapter <a href="dots-prefix.html"><span>Chapter&nbsp;23</span></a>.)</p>
<p>(Also note that <code><a href="https://purrr.tidyverse.org/reference/pmap.html">pmap()</a></code> uses the <code>.</code> prefix to avoid the problem described in Chapter <a href="dots-prefix.html"><span>Chapter&nbsp;24</span></a>.)</p>



Expand Down
5 changes: 5 additions & 0 deletions cs-rep.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down
11 changes: 8 additions & 3 deletions cs-rvest.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<script src="site_libs/quarto-search/fuse.min.js"></script>
<script src="site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="./">
<link href="./def-magical.html" rel="next">
<link href="./identity-strategy.html" rel="next">
<link href="./implicit-strategies.html" rel="prev">
<script src="site_libs/quarto-html/quarto.js"></script>
<script src="site_libs/quarto-html/popper.min.js"></script>
Expand Down Expand Up @@ -221,6 +221,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link active"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down Expand Up @@ -688,8 +693,8 @@ <h1 class="title"><span class="chapter-title">Case study: <code>html_element()</
</a>
</div>
<div class="nav-page nav-page-next">
<a href="./def-magical.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-title">Avoid magical defaults</span></span> <i class="bi bi-arrow-right-short"></i>
<a href="./identity-strategy.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-title">The I()dentity strategy</span></span> <i class="bi bi-arrow-right-short"></i>
</a>
</div>
</nav>
Expand Down
7 changes: 6 additions & 1 deletion cs-setNames.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<i class="bi bi-layout-text-sidebar-reverse"></i>
</button>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./cs-setNames.html"><span class="chapter-number">26</span>&nbsp; <span class="chapter-title">Case study: `setNames()`</span></a></li></ol></nav>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./cs-setNames.html"><span class="chapter-number">27</span>&nbsp; <span class="chapter-title">Case study: `setNames()`</span></a></li></ol></nav>
<a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
</a>
<button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
Expand Down Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down
9 changes: 7 additions & 2 deletions def-inform.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<i class="bi bi-layout-text-sidebar-reverse"></i>
</button>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./def-inform.html"><span class="chapter-number">20</span>&nbsp; <span class="chapter-title">Explain important defaults</span></a></li></ol></nav>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./def-inform.html"><span class="chapter-number">21</span>&nbsp; <span class="chapter-title">Explain important defaults</span></a></li></ol></nav>
<a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
</a>
<button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
Expand Down Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down Expand Up @@ -539,7 +544,7 @@ <h1 class="title"><span class="chapter-title">Explain important defaults</span><
<span><span class="co">#&gt; [1] "year" "tailnum"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>The technique you use to generate the code will vary from function to function. <code><a href="https://rlang.r-lib.org/reference/expr_label.html">rlang::expr_text()</a></code> is useful here because it automatically creates the code you’d use to build the character vector.</p>
<p>To avoid creating a magical default (<a href="def-magical.html"><span>Chapter&nbsp;19</span></a>), either export and document the function, or use one of the techniques in <a href="defaults-short-and-sweet.html"><span>Chapter&nbsp;9</span></a>:</p>
<p>To avoid creating a magical default (<a href="def-magical.html"><span>Chapter&nbsp;20</span></a>), either export and document the function, or use one of the techniques in <a href="defaults-short-and-sweet.html"><span>Chapter&nbsp;9</span></a>:</p>
<div class="cell">
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">left_join</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span>, <span class="va">y</span>, <span class="va">by</span> <span class="op">=</span> <span class="cn">NULL</span><span class="op">)</span> <span class="op">{</span></span>
<span> <span class="va">by</span> <span class="op">&lt;-</span> <span class="va">by</span> <span class="op">%||%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/common_by.html">common_by</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">y</span><span class="op">)</span></span>
Expand Down
13 changes: 9 additions & 4 deletions def-magical.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<script src="site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="./">
<link href="./def-inform.html" rel="next">
<link href="./cs-rvest.html" rel="prev">
<link href="./identity-strategy.html" rel="prev">
<script src="site_libs/quarto-html/quarto.js"></script>
<script src="site_libs/quarto-html/popper.min.js"></script>
<script src="site_libs/quarto-html/tippy.umd.min.js"></script>
Expand Down Expand Up @@ -100,7 +100,7 @@
<button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<i class="bi bi-layout-text-sidebar-reverse"></i>
</button>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./def-magical.html"><span class="chapter-number">19</span>&nbsp; <span class="chapter-title">Avoid magical defaults</span></a></li></ol></nav>
<nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="./def-magical.html">Function arguments</a></li><li class="breadcrumb-item"><a href="./def-magical.html"><span class="chapter-number">20</span>&nbsp; <span class="chapter-title">Avoid magical defaults</span></a></li></ol></nav>
<a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
</a>
<button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
Expand Down Expand Up @@ -255,6 +255,11 @@
<div class="sidebar-item-container">
<a href="./cs-rvest.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">Case study: <code>html_element()</code></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./identity-strategy.html" class="sidebar-item-text sidebar-link"><span class="chapter-title">The I()dentity strategy</span></a>
</div>
</li>
</ul>
</li>
Expand Down Expand Up @@ -796,8 +801,8 @@ <h1 class="title"><span class="chapter-title">Avoid magical defaults</span></h1>
}
});
</script><nav class="page-navigation"><div class="nav-page nav-page-previous">
<a href="./cs-rvest.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-title">Case study: <code>html_element()</code></span></span>
<a href="./identity-strategy.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-title">The I()dentity strategy</span></span>
</a>
</div>
<div class="nav-page nav-page-next">
Expand Down
Loading

0 comments on commit b075b06

Please sign in to comment.