Skip to contents

Clean speeds

Usage

clean_speeds(osm)

Arguments

osm

An sf object with the road network

Value

An sf object with the cleaned speed values in the column maxspeed_clean

Examples

osm = osm_edinburgh
osm_cleaned = clean_speeds(osm)
# check NAs:
sel_nas = is.na(osm_cleaned$maxspeed_clean)
osm_no_maxspeed = osm_cleaned[sel_nas, c("highway")]
table(osm_no_maxspeed$highway) # Active travel infrastructure has no maxspeed
#> 
#>   cycleway    footway       path pedestrian 
#>          2         24          1          3 
table(osm_cleaned$maxspeed)
#> 
#> 20 mph  5 mph 
#>     42      1 
table(osm_cleaned$maxspeed_clean)
#> 
#>  5 20 30 
#>  1 42 50 
plot(osm_cleaned[c("maxspeed", "maxspeed_clean")])