Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
yjunechoe committed Jun 9, 2024
1 parent 10a6f01 commit 240f226
Show file tree
Hide file tree
Showing 7 changed files with 3,854 additions and 3,591 deletions.
4 changes: 2 additions & 2 deletions _posts/2024-06-09-ave-for-the-average/ave-for-the-average.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ I think it's safe to say that the average `{dplyr}` user does not know the `ave(

## `ave()`

`ave()` is a split-apply-function in base R (specifically, `{stats}`). It's a pretty short function - maybe you can make out what it does from just reading the code^[And check out the elusive `split<-` function!]
`ave()` is a split-apply-combine function in base R (specifically, `{stats}`). It's a pretty short function - maybe you can make out what it does from just reading the code^[And check out the elusive `split<-` function!]

```{r}
ave
Expand Down Expand Up @@ -130,7 +130,7 @@ input %>%
...
```

I'll note that there's actually also an idiomatic `{dplyr}`-solution to this using the lesser-known function `add_count()`, but you can't avoid the repetitiveness problem because it doesn't vectorize on the first argument:
I'll note that there's actually also an idiomatic `{dplyr}`-solution to this using the lesser-known function `add_count()`, but you can't avoid the repetitiveness problem because it doesn't vectorize over the first argument:

```{r}
input %>%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ <h3>Contents</h3>
</div>
<p>I think it’s safe to say that the average <code>{dplyr}</code> user does not know the <code>ave()</code> function. For that audience, this is a short appreciation post on <code>ave()</code>, a case of tidyverse <em>and</em> base R.</p>
<h2 id="ave"><code>ave()</code></h2>
<p><code>ave()</code> is a split-apply-function in base R (specifically, <code>{stats}</code>). It’s a pretty short function - maybe you can make out what it does from just reading the code<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
<p><code>ave()</code> is a split-apply-combine function in base R (specifically, <code>{stats}</code>). It’s a pretty short function - maybe you can make out what it does from just reading the code<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
<div class="layout-chunk" data-layout="l-body">
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r"><span><span class='va'>ave</span></span></code></pre>
Expand All @@ -1584,7 +1584,7 @@ <h2 id="ave"><code>ave()</code></h2>
}
x
}
&lt;bytecode: 0x0000020b91307c48&gt;
&lt;bytecode: 0x0000020fc12974b8&gt;
&lt;environment: namespace:stats&gt;</code></pre>
</div>
<p>Despite its (rather generic and uninformative) name, I like to think of <code>ave()</code> as actually belonging to the <code>*apply()</code> family of functions, having particularly close ties to <code>tapply()</code>.</p>
Expand Down Expand Up @@ -1704,7 +1704,7 @@ <h2 id="some-tidyverse-solutions">Some <code>{tidyverse}</code> solutions</h2>
<span> <span class='va'>...</span></span></code></pre>
</div>
</div>
<p>I’ll note that there’s actually also an idiomatic <code>{dplyr}</code>-solution to this using the lesser-known function <code>add_count()</code>, but you can’t avoid the repetitiveness problem because it doesn’t vectorize on the first argument:</p>
<p>I’ll note that there’s actually also an idiomatic <code>{dplyr}</code>-solution to this using the lesser-known function <code>add_count()</code>, but you can’t avoid the repetitiveness problem because it doesn’t vectorize over the first argument:</p>
<div class="layout-chunk" data-layout="l-body">
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r"><span><span class='va'>input</span> <span class='op'><a href='https://magrittr.tidyverse.org/reference/pipe.html'>%&gt;%</a></span> </span>
Expand Down
Loading

0 comments on commit 240f226

Please sign in to comment.