Calculate the gradient of line segments from distance and elevation vectors

route_slope_vector(x, e)

Arguments

x

Vector of locations

e

Elevations in same units as x (assumed to be metres)

See also

Examples

x <- c(0, 2, 3, 4, 5, 9)
e <- c(1, 2, 2, 4, 3, 1) / 10
route_slope_vector(x, e)
#> [1]  0.05  0.00  0.20 -0.10 -0.05