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
#> 
#>   corridor   cycleway    footway       path pedestrian      steps 
#>          3         17         33          1          6         10 
table(osm_cleaned$maxspeed)
#> 
#> 20 mph  5 mph 
#>     42      1 
table(osm_cleaned$maxspeed_clean)
#> 
#>  5 20 
#>  1 52 
plot(osm_cleaned[c("maxspeed", "maxspeed_clean")])