Description Usage Arguments Examples
View source: R/frontend_functions.R
Aggregate a column where some condition is true - meant to be used inside tidy functions. This is not even a convenience function as it can be done simpler in native tidyverse (se examples). The function exists in order to highlight a programming pattern.
1 | aggregate_where(fun, var, cond)
|
fun |
The aggregation function to run |
var |
The variable to run the function on |
cond |
The condition to filter on |
1 2 3 4 5 6 7 | ## Not run:
mutate(msft, fincol = aggregate_where(mean, adj_close, change=="UP") )
# Equivalent to
mutate(msft, fincol = mean(adj_close[change=="UP"] ))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.