Return smoothed averages of vector
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.
route_rolling_average(x, n = 3)
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. |
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.