# ANN: RollingFunctions.jl

**URL:** <https://discourse.julialang.org/t/ann-rollingfunctions-jl/3279>\
**Category:** Community\
**Tags:** package, announcement\
**Created:** [April 19, 2017, 10:25am UTC](https://discourse.julialang.org/t/ann-rollingfunctions-jl/3279 "2017-04-19T10:25:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [April 19, 2017, 10:25am UTC](https://discourse.julialang.org/t/ann-rollingfunctions-jl/3279/1 "2017-04-19T10:25:58Z")

</div>

Roll a function over data (run a windowed function along data).

* * *

(abridged from the [README](https://github.com/JeffreySarnoff/RollingFunctions.jl/blob/master/README.md))

#### exports

##### windowed functions

```julia
roll_minimum, roll_maximum, 
roll_mean, roll_median,
roll_std, roll_var, roll_mad, 
roll_sum, roll_prod, roll_norm

```

##### how to fill, if desired

```julia
FILL_FIRST, FILL_LAST, FILL_BOTH, # same value used repeatedly    
TAPER_FIRST, TAPER_LAST, TAPER_BOTH # smaller windows (to `tapered_size`) used, copies last repeatedly    
                                      # note: `tapered_size = max(2, tapered_size)`, needed for coherence

```

##### windowed function construction

```julia
rolling

```

#### use

This example shows how you may create other running functions.  
You do not need to define all of the forms, just the ones you want to use.

```julia
import StatsBase: middle
using RollingFunctions

const V=Vector # for this post only 

# Roll a function.
# define it
roll_middle{T}(window::Int, data::V{T}) =
    rolling(middle, window, data)
# use it
rolled = roll_middle(window, data)

# Roll a function filling the first part with NaNs.
# define it
roll_middle{T}(FILL_FIRST, window::Int, fill::T, data::V{T}) =
    rolling(FILL_FIRST, middle, window, filler, data)
# specialize it
roll_middle_NaN{T}(window::Int, data::V{T}) =
    roll_middle(FILL_FIRST, window, (T)NaN, data)
# use it
rolled = roll_middle_NaN(window, data)

# Roll a function over weighted windows.
# define it
roll_middle{T}(window::Int, weights::V{T}, data::V{T}) =
    rolling(middle, window, weights, data)
# use it
rolled_weighted = roll_middle(window, weights, data)

```
