route_rolling_average: Return smoothed averages of vector
Description
This function calculates a simple rolling mean in base R.
It is useful for calculating route characteristics such as mean
distances of segments and changes in gradient.
Usage
route_rolling_average(x, n = 3)
Arguments
x
Numeric vector to smooth
n
The window size of the smoothing function.
The default, 3, will take the mean of values before, after and including
each value.
See Also
Other route_funs:
route_average_gradient(),
route_rolling_diff(),
route_rolling_gradient(),
route_sequential_dist(),
route_slope_matrix(),
route_slope_vector()
y <- od_data_routes$elevations[od_data_routes$route_number == 2]
y
route_rolling_average(y)
route_rolling_average(y, n = 1)
route_rolling_average(y, n = 2)
route_rolling_average(y, n = 3)