This function assumes that elevations and distances are in the same units.
Elevations, e.g. those provided by the
Distances, e.g. those provided by the
r1 <- od_data_routes[od_data_routes$route_number == 2, ] elevations <- r1$elevations distances <- r1$distances route_average_gradient(elevations, distances) # an average of a 4% gradient #>  0.03907936