Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

each

Aggregate multiple functions into a single function.


Description

Combine multiple functions into a single function returning a named vector of outputs. Note: you cannot supply additional parameters for the summary functions

Usage

each(...)

Arguments

...

functions to combine. each function should produce a single number as output

See Also

summarise for applying summary functions to data

Examples

# Call min() and max() on the vector 1:10
each(min, max)(1:10)
# This syntax looks a little different.  It is shorthand for the
# the following:
f<- each(min, max)
f(1:10)
# Three equivalent ways to call min() and max() on the vector 1:10
each("min", "max")(1:10)
each(c("min", "max"))(1:10)
each(c(min, max))(1:10)
# Call length(), min() and max() on a random normal vector
each(length, mean, var)(rnorm(100))

plyr

Tools for Splitting, Applying and Combining Data

v1.8.6
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.