window_fun | R Documentation |
This is faster version of ave. window_fun
applies function
to every subset of x
and return vector of the same length as x
.
window_fun(x, ...)
x |
A vector |
... |
Grouping variables all of the same length as x or length 1 and function as last argument. |
vector of the same length as x
window_fun(1:3, mean) # no grouping -> grand mean
attach(warpbreaks)
window_fun(breaks, wool, mean)
window_fun(breaks, tension, function(x) mean(x, trim = 0.1))
detach(warpbreaks)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.