This function assumes that elevations and distances are in the same units.
Usage
route_average_gradient(elevations, distances)
Arguments
- elevations
Elevations, e.g. those provided by the cyclestreets package
- distances
Distances, e.g. those provided by the cyclestreets package
Examples
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
#> [1] 0.03907936